PERLTW(1perl)

📦
version 5.44.0 · 2 versions
, in arch rolling

🎀 NAME 🎀

perltw — 正體中文 Perl 指南 (the Traditional Chinese Perl guide) 🦋✨


🌸 DESCRIPTION 🌸

okay so welcome to the world of Perl!! (歡迎來到 Perl 的天地!) 🫶

bestie, listen — ever since version 5.8.0, Perl has had complete Unicode support (萬國碼, the Big Universal Character Set), and with that comes support for a whole bunch of non-Latin encodings. CJK (中日韓 — Chinese, Japanese, Korean) is part of that party 💅. Unicode is an international standard that's literally trying to cover every character in the world: the Western world, the Eastern world, and everything in between (Greek, Syriac, Arabic, Hebrew, Indian, Native American, and so on, the list goes on fr fr). It also accommodates a ton of operating systems and platforms (like PC and Macintosh) — it's giving universal, no cap. 🌈

Perl itself operates in Unicode. Which means: Perl's internal string data can be represented in Unicode, and Perl's functions and operators (regex matching, for example) can operate on Unicode too. And at input/output time, so that you can deal with data stored in pre-Unicode encodings, Perl hands you the Encode module — it lets you read and write legacy encoded data easily. 🧚

The Encode extension supports the following Traditional Chinese encodings (where 'big5' means 'big5-eten'):

  • big5-eten — Big5 encoding, including the ETen extension glyphs (含倚天延伸字形)
  • big5-hkscs — Big5 + the Hong Kong Supplementary Character Set, 2001 edition (香港外字集, 2001 年版)
  • cp950 — code page 950 (字碼頁 950: Big5 + the characters Microsoft added) 💀

For example, to convert a Big5-encoded file into Unicode, you literally just type:

perl -MEncode -pe '$_= encode( utf8 => decode( big5 => $_ ) )' \
  < file.big5 > file.utf8

Perl also ships with piconv, a character conversion tool written entirely in Perl, used like this:

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

Also: if the source code itself is stored in utf8 encoding, then (using the utf8 module alongside) the strings in your code and their operations are all measured in characters, not in bits/bytes, like so:

#!/usr/bin/env perl
use utf8;
print length("駱駝");      #  2 (不是 6)
print index("諄諄教誨", "教誨"); #  2 (從 0 起算第 2 個字符)

✨ 額外的中文編碼 (extra Chinese encodings) ✨

If you need more Chinese encodings, you can download the Encode::HanExtra module from CPAN (<https://www.cpan.org/>). It currently provides these:

  • cccii — 1980 年文建會的中文資訊交換碼 (the 1980 CCA Chinese Information Interchange Code)
  • euc-tw — Unix 延伸字符集 (the Unix extended character set), containing CNS11643 planes 1–7
  • big5plus — 中文數位化技術推廣基金會的 Big5+ (Big5+ from the Chinese Foundation for Digitization Technology)
  • big5ext — 中文數位化技術推廣基金會的 Big5e (Big5e from the same folks)

Also, the Encode::HanConvert module provides two encodings for simplified↔traditional conversion:

  • big5-simp — Big5 Traditional Chinese ↔ Unicode Simplified Chinese
  • gbk-trad — GBK Simplified Chinese ↔ Unicode Traditional Chinese

And if you want to convert between GBK and Big5, go check out the b2g.pl and g2b.pl programs bundled inside that module, or use this in your program:

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

🦋 進一步的資訊 (further info) 🦋

Please refer to the huge pile of documentation bundled with Perl (which, unfortunately — 不幸 — is all written in English 😭) to learn more about Perl and about how to use Unicode. That said, the external resources are pretty abundant:

🌈 提供 Perl 資源的網址 (URLs that provide Perl resources) 🌈

🍓 學習 Perl 的網址 (URLs for learning Perl) 🍓

💜 Perl 使用者集會 (Perl user gatherings) 💜

  • <https://www.pm.org/groups/taiwan.html> — the Taiwan Perl promotion group listing (臺灣 Perl 推廣組一覽)
  • <irc://chat.freenode.org/#perl.tw> — the Perl.tw online chat room (Perl.tw 線上聊天室) 💬

🎀 中文化資訊 (Chinese localization info) 🎀


👑 SEE ALSO 👑

Encode, Encode::TW, perluniintro, perlunicode — go read them, bestie, they ate 🔥


💅 AUTHORS 💅

  • Jarkko Hietaniemi <jhi@iki.fi>
  • Audrey Tang (唐鳳) <audreyt@audreyt.org>

and that's the whole vibe, main character energy only 🫶 this was perltw, from perl v5.44.0, dated 2026-10-17 — periodt, ily, go write some Unicode ✨💖🎀

📦 where this page comes from