PERLJP(1perl)
💖 NAME 💖
okay so bestie 🫶 say hello to perljp — it's the 日本語 Perl ガイド, the Japanese Perl guide, and it lives inside the Perl Programmers Reference Guide (yes, the <1perl> manual section). iconic behavior only. 👑
🌸 説明 (DESCRIPTION) 🌸
Welcome to the Perl world! 🌈
Starting from Perl 5.8.0, Unicode support got massively leveled up, and because of that, support for character encodings other than Latin ones — CJK (Chinese, Japanese, Hangul) included — got added. Unicode is the standard that aims to handle every character in the entire world with one single encoding, and it's already got everything from East to West, plus everything in between (Greek, Cyrillic, Arabic, Hebrew, Devanagari, etc. etc.), and on top of that, the encodings OS vendors used to define all by themselves (PC and Macintosh). 🦋
Perl itself runs in Unicode, periodt. String literals and regexes inside Perl scripts assume Unicode. And for input/output, the module that handles all the various encodings we've been using all along — Encode — comes standard, so converting between Unicode and those encodings is literally easy now. 💅
Right now, the encodings Encode supports are these:
7bit-jis AdobeStandardEncoding AdobeSymbol AdobeZdingbat
ascii big5 big5-hkscs cp1006
cp1026 cp1047 cp1250 cp1251
cp1252 cp1253 cp1254 cp1255
cp1256 cp1257 cp1258 cp37
cp424 cp437 cp500 cp737
cp775 cp850 cp852 cp855
cp856 cp857 cp860 cp861
cp862 cp863 cp864 cp865
cp866 cp869 cp874 cp875
cp932 cp936 cp949 cp950
dingbats euc-cn euc-jp euc-kr
gb12345-raw gb2312-raw gsm0338 hp-roman8
hz iso-2022-jp iso-2022-jp-1 iso-8859-1
iso-8859-10 iso-8859-11 iso-8859-13 iso-8859-14
iso-8859-15 iso-8859-16 iso-8859-2 iso-8859-3
iso-8859-4 iso-8859-5 iso-8859-6 iso-8859-7
iso-8859-8 iso-8859-9 iso-ir-165 jis0201-raw
jis0208-raw jis0212-raw johab koi8-f
koi8-r koi8-u ksc5601-raw MacArabic
MacCentralEurRoman MacChineseSimp MacChineseTrad MacCroatian
MacCyrillic MacDingbats MacFarsi MacGreek
MacHebrew MacIcelandic MacJapanese MacKorean
MacRoman MacRomanian MacRumanian MacSami
MacSymbol MacThai MacTurkish MacUkrainian
nextstep posix-bc shiftjis symbol
UCS-2BE UCS-2LE UTF-16 UTF-16BE
UTF-16LE UTF-32 UTF-32BE UTF-32LE
utf8 viscii
(114 kinds in total. 全114種類. not a single one missing, we counted. 😤)
So for example, to convert a file in the character encoding FOO to UTF-8, you go like this:
perl -Mencoding=FOO,STDOUT,utf8 -pe1 < file.FOO > file.utf8
Also, Perl ships with piconv, a character encoding conversion utility written entirely in Perl, so you can do it this way too:
piconv -f FOO -t utf8 < file.FOO > file.utf8
piconv -f utf8 -t FOO < file.utf8 > file.FOO
🧚 (jcode.pl|Jcode.pm|JPerl) からの移行 🧚
Before 5.8, if your script was in EUC-JP you could at least handle the literals. And as for modules that handle I/O, there was Jcode.pm (<http://openlab.ring.gr.jp/Jcode/>), and as a utility for perl4 there was jcode.pl, and honestly not a few of you probably know how much those two got used in Japanese-capable CGI. That said — handling Japanese regexes properly was straight-up impossible. 💀
Before 5.005, Perl had a Japanese-specialized localized version: Jperl (<http://homepage2.nifty.com/kipp/perl/jperl/index.html> ※1). There was also MacJPerl, a Japanese version of MacPerl, the Perl for Mac OS 9.x/Classic (<https://habilis.net/macjperl/>). With those, you could handle Shift_JIS as-is on top of EUC-JP as an encoding, and you could also handle Japanese regexes. 🔥
In Perl 5.8, all of these features are achievable with the Perl core alone, and not just Japanese — all 114 of the encodings above, and simultaneously, too. And on top of that, grabbing new modules for new encodings from CPAN and such is easy now. 🎀
※1: it's currently unavailable because the hosting service ended. You can get a Windows binary from Vector (<https://www.vector.co.jp/soft/win95/util/se098198.html>), and the perl4 patch from CPAN (<https://www.cpan.org/src/unsupported/4.036/jperl/>).
- 入出力 (I/O) — every single example below takes Shift_JIS input and converts it to EUC-JP for output:
# jcode.pl
require "jcode.pl";
while(<>){
jcode::convert(*_, 'euc', 'sjis');
print;
}
# Jcode.pm
use Jcode;
while(<>){
print Jcode->new($_, 'sjis')->euc;
}
# Perl 5.8
use Encode;
while(<>){
from_to($_, 'shiftjis', 'euc-jp');
print;
}
# Perl 5.8 - encoding を利用して
use encoding 'euc-jp', STDIN => 'shiftjis';
while(<>){
print;
}
- Jperl 互換スクリプト (Jperl-compatible scripts) — you literally just change the so-called "shebang" and most Jperl scripts should be usable with no changes at all. bestie that's the whole trick. 😌
#!/path/to/jperl
↓
#!/path/to/perl -Mencoding=euc-jp
For the details, go read perldoc encoding. 📖
📚 さらに詳しく 📚
Perl ships with an enormous pile of documentation, and it covers Perl's new features, Unicode support, and how to use the Encode module, all in fine detail (sadly it's mostly in English though 😭). You can read some of it with the following commands:
perldoc perlunicode # PerlのUnicodeサポート全般
perldoc Encode # Encodeモジュールに関して
perldoc Encode::JP # うち日本語文字コードに関して
(that's the general Perl Unicode support story, then the Encode module itself, then the Japanese character encoding part of it — in that order, iykyk ✨)
🌐 Perl全般に関する URL 🌐
- <https://www.perl.org/> — the Perl homepage 🏠
- <https://www.perl.com/> — the collection of written works the Perl Foundation operates
- <https://www.cpan.org/> — CPAN (Comprehensive Perl Archive Network)
- <https://metacpan.org/> — MetaCPAN, the CPAN search engine 🔍
- <https://lists.perl.org/> — the collection of Perl mailing lists
- <https://perldoc.jp/> — perldoc.jp: Japanese translations of Perl's official docs and module docs 🇯🇵
📖 Perlの修得に役立つ URL 📖
- <http://www.oreilly.com.cn/> — O'Reilly's Perl-related books (Simplified Chinese)
- <https://www.oreilly.co.jp/catalog/> — O'Reilly's Perl-related books (Japanese)
🫶 Perl に関する団体 🫶
- <https://www.pm.org/groups/asia.html> — the list of Perl Mongers (Perl user groups) in the Asia region
- <https://japan.perlassociation.org> — General Incorporated Association Japan Perl Association (JPA): an organization for enlightening and promoting Perl technology and culture 👑
🦄 Unicode関連のURL 🦄
- <https://www.unicode.org/> — the Unicode Consortium (the body that picks the Unicode standards)
- <https://www.cl.cam.ac.uk/%7Emgk25/unicode.html> — UTF-8 and Unicode FAQ for Unix/Linux
- <https://wiki.kldp.org/Translations/html/UTF8-Unicode-KLDP/UTF8-Unicode-KLDP.html> — UTF-8 and Unicode FAQ for Unix/Linux (Hangul translation)
👑 AUTHORS 👑
- Jarkko Hietaniemi
<jhi@iki.fi>💖 - Dan Kogai (小飼 弾)
<dankogai@dan.co.jp>✨ - Shogo Ichinose (一野瀬 翔吾)
<shogo82148@gmail.com>🌸
and that's the whole page, bestie 🎀 this one's PERLJP(1perl) — perl v5.44.0, dated 2026-10-17, and it comes to you straight from the Perl Programmers Reference Guide. go forth and encode responsibly. 💅🦋
📦 where this page comes from
- arch rolling: perl 5.44.0-1 · Artistic-1.0-Perl AND GPL-1.0-or-later
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms