Welcome to Linux Knowledge Base and Tutorial
"The place where you learn linux"

 Create an AccountHome | Submit News | Your Account  

Tutorial Menu
Linux Tutorial Home
Table of Contents

· Introduction to Operating Systems
· Linux Basics
· Working with the System
· Shells and Utilities
· Editing Files
· Basic Administration
· The Operating System
· The X Windowing System
· The Computer Itself
· Networking
· System Monitoring
· Solving Problems
· Security
· Installing and Upgrading
· Linux and Windows

Glossary
MoreInfo
Man Pages
Linux Topics
Test Your Knowledge

Site Menu
Site Map
FAQ
Copyright Info
Terms of Use
Privacy Info
Disclaimer
WorkBoard
Thanks
Donations
Advertising
Masthead / Impressum
Your Account

Communication
Feedback
Forums
Private Messages
Surveys

Features
HOWTOs
News Archive
Submit News
Topics
User Articles
Web Links

Google
Google


The Web
linux-tutorial.info

Who's Online
There are currently, 52 guest(s) and 0 member(s) that are online.

You are an Anonymous user. You can register for free by clicking here

  

perltw



DESCRIPTION

       歡迎來到 Perl 的天地!

       從 5.8.0 版開始, Perl 具備了完善的 Unicode (萬國碼) 支援,
       也連帶支援了許多拉丁語系以外的編碼方式; CJK (中日韓)
       便是其中的一部份.  Unicode 是國際性的標準,
       試圖涵蓋世界上所有的字符: 西方世界, 東方世界,
       以及兩者間的一切 (希臘文, 敘利亞文, 阿拉伯文, 希伯來文,
       印度文, 印地安文, 等等). 它也容納了多種作業系統與平臺 (如
       PC 及麥金塔).

       Perl 本身以 Unicode 進行操作. 這表示 Perl
       內部的字串資料可用 Unicode 表示; Perl 的函式與算符
       (例如正規表示式比對) 也能對 Unicode 進行操作.
       在輸入及輸出時, 為了處理以 Unicode
       之前的編碼方式儲存的資料, Perl 提供了 Encode 這個模組,
       可以讓你輕易地讀取及寫入舊有的編碼資料.

       Encode 延伸模組支援下列正體中文的編碼方式 ('big5' 表示
       'big5-eten'):

           big5-eten   Big5 編碼 (含倚天延伸字形)
           big5-hkscs  Big5 + 香港外字集, 2001 年版
           cp950       字碼頁 950 (Big5 + 微軟添加的字符)

       舉例來說, 將 Big5 編碼的檔案轉成 Unicode,
       祗需鍵入下列指令:

           perl -Mencoding=big5,STDOUT,utf8 -pe1 < file.big5 > file.utf8

       Perl 也內附了 "piconv", 一支完全以 Perl
       寫成的字符轉換工具程式, 用法如下:

           piconv -f big5 -t utf8 < file.big5 > file.utf8
           piconv -f utf8 -t big5 < file.utf8 > file.big5

       另外, 利用 encoding 模組,
       你可以輕易寫出以字符為單位的程式碼, 如下所示:

           #!/usr/bin/env perl
           # 啟動 big5 字串解析; 標準輸出入及標準錯誤都設為 big5 編碼
           use encoding 'big5', STDIN => 'big5', STDOUT => 'big5';
           print length("駱駝");            #  2 (雙引號表示字符)
           print length('駱駝');            #  4 (單引號表示位元組)
           print index("諄諄教誨", "彖帢"); # -1 (不包含此子字串)
           print index('諄諄教誨', '彖帢'); #  1 (從第二個位元組開始)

       在最後一列例子裡, "諄" 的第二個位元組與 "諄"
       的第一個位元組結合成 Big5 碼的 "彖"; "諄"
       的第二個位元組則與 "教" 的第一個位元組結合成 "帢".
       這解決了以前 Big5 碼比對處理上常見的問題.

           big5-simp   Big5 正體中文與 Unicode 簡體中文互轉
           gbk-trad    GBK 簡體中文與 Unicode 正體中文互轉

       若想在 GBK 與 Big5 之間互轉, 請參考該模組內附的 b2g.pl 與
       g2b.pl 兩支程式, 或在程式內使用下列寫法:

           use Encode::HanConvert;
           $euc_cn = big5_to_gb($big5); # 從 Big5 轉為 GBK
           $big5 = gb_to_big5($euc_cn); # 從 GBK 轉為 Big5

       進一步的資訊

       請參考 Perl 內附的大量說明文件 (不幸全是用英文寫的),
       來學習更多關於 Perl 的知識, 以及 Unicode 的使用方式. 不過,
       外部的資源相當豐富:

       提供 Perl 資源的網址

       <http://www.perl.com/>
           Perl 的首頁 (由歐萊禮公司維護)

       <http://www.cpan.org/>
           Perl 綜合典藏網 (Comprehensive Perl Archive Network)

       <http://lists.perl.org/>
           Perl 郵遞論壇一覽

       學習 Perl 的網址

       <http://www.oreilly.com.tw/chinese/perl/index.html>
           正體中文版的歐萊禮 Perl 書藉

       <http://groups.google.com/groups?q=tw.bbs.comp.lang.perl>
           臺灣 Perl 連線討論區 (也就是各大 BBS 的 Perl 連線版)

       Perl 使用者集會

       <http://www.pm.org/groups/asia.shtml#Taiwan>
           臺灣 Perl 推廣組一覽

       <http://irc.elixus.org/>
           藝立協線上聊天室

       Unicode 相關網址

       <http://www.unicode.org/>
           Unicode 學術學會 (Unicode 標準的制定者)

           <http://www.linux.org.tw/CLDP/>


SEE ALSO

       Encode, Encode::TW, encoding, perluniintro, perlunicode


AUTHORS

       Jarkko Hietaniemi <jhi@iki.fi>

       Autrijus Tang (唐宗漢) <autrijus@autrijus.org>

perl v5.8.1                 2003-09-02                  PERLTW(1)

An undefined database error occurred. SELECT distinct pages.pagepath,pages.pageid FROM pages, page2command WHERE pages.pageid = page2command.pageid AND commandid =


  




Login
Nickname

Password

Security Code
Security Code
Type Security Code


Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name.

Help if you can!


Amazon Wish List

Did You Know?
The Linux Tutorial can use your help.


Friends



Tell a Friend About Us

Bookmark and Share



Web site powered by PHP-Nuke

Is this information useful? At the very least you can help by spreading the word to your favorite newsgroups, mailing lists and forums.
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters. Articles are the property of their respective owners. Unless otherwise stated in the body of the article, article content (C) 1994-2013 by James Mohr. All rights reserved. The stylized page/paper, as well as the terms "The Linux Tutorial", "The Linux Server Tutorial", "The Linux Knowledge Base and Tutorial" and "The place where you learn Linux" are service marks of James Mohr. All rights reserved.
The Linux Knowledge Base and Tutorial may contain links to sites on the Internet, which are owned and operated by third parties. The Linux Tutorial is not responsible for the content of any such third-party site. By viewing/utilizing this web site, you have agreed to our disclaimer, terms of use and privacy policy. Use of automated download software ("harvesters") such as wget, httrack, etc. causes the site to quickly exceed its bandwidth limitation and are therefore expressly prohibited. For more details on this, take a look here

PHP-Nuke Copyright © 2004 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.09 Seconds