PERLTW(1)

💖 NAME 💖

perltw — the 正體中文 Perl 指南, aka your Traditional Chinese Perl guide. This one lives in the Perl Programmers Reference Guide, and bestie, if you've ever wanted Perl to stop treating 駱駝 like six separate little byte-guys, this is the page. 🦋


✨ DESCRIPTION ✨

Welcome to the Perl-verse!! 🎀

Starting from version 5.8.0, Perl came through with complete Unicode (萬國碼) support, and it also supports a whole bunch of encodings beyond the Latin-script ones. CJK — Chinese, Japanese, Korean — is one of those parts. 💅

Unicode is the international standard, out here trying to cover every character in the world: the Western world, the Eastern world, and literally everything in between (Greek, Syriac, Arabic, Hebrew, Indian, Native American, etc., etc.). It also holds space for many operating systems and platforms (like PC and Macintosh). 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 on the way in and the way out — for handling data stored in pre-Unicode encodings — Perl hands you the Encode module, so you can read and write all that old encoded data easily.

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

  • big5-eten — the Big5 encoding (with ETen extension glyphs)
  • big5-hkscs — Big5 + Hong Kong Supplementary Character Set, 2001 edition
  • cp950 — code page 950 (Big5 + the characters Microsoft added)

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

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

Perl also ships with piconv, a character conversion tool written entirely in Perl. Use it like:

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, pair it with the utf8 module and the strings in your code — plus the operations on them — work in characters instead of bits, like this:

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

🍓 額外的中文編碼 🍓

If you need more Chinese encodings, you can download the Encode::HanExtra module from CPAN (<https://www.cpan.org/>). Right now it offers these:

  • cccii — the 1980 年文建會的中文資訊交換碼
  • euc-tw — Unix 延伸字符集, includes CNS11643 planes 1-7
  • big5plus — 中文數位化技術推廣基金會的 Big5+
  • big5ext — 中文數位化技術推廣基金會的 Big5e

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

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

Wanna convert between GBK and Big5? Go peek at the b2g.pl and g2b.pl programs that come bundled with that module, or do it right inside your program like this:

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

🌈 進一步的資訊 🌈

Go read the huge pile of documentation that ships inside Perl (sadly it's all written in English 😭) to learn more about Perl and about how to use Unicode. But honestly the outside resources are super abundant:

🔥 提供 Perl 資源的網址 🔥

📚 學習 Perl 的網址 📚

👑 Perl 使用者集會 👑

🦋 Unicode 相關網址 🦋

💜 中文化資訊 💜


👀 SEE ALSO 👀

Encode, Encode::TW, perluniintro, perlunicode


🫶 AUTHORS 🫶

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

And that's the whole vibe, bestie 💖 this was perl v5.42.3, dated 2026-08-03 — go convert something iconic. 💅✨

📦 where this page comes from