Come uso i caratteri Unicode in Pod e perldoc?
-
03-07-2019 - |
Domanda
Devo usare i caratteri utf-8 nella mia documentazione perl. Se uso:
perldoc MyMod.pm
Vedo strani personaggi. Se uso:
pod2text MyMod.pm
va tutto bene.
Uso Ubuntu / Debian.
$ locale
LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=de_DE.UTF-8
Esiste un HowTo sull'uso di caratteri speciali in Pod?
Ecco un piccolo esempio usando le umlaut tedesche " Just a Test: & # 228; & # 246; & # 252; & # 223; & # 196; & # 214; " ;:
$ perldoc perl/MyMod.pm
<standard input>:72: warning: can't find character with input code 159
<standard input>:72: warning: can't find character with input code 150
MyMod(3) User Contributed Perl Documentation MyMod(3)
NAME
MyMod.pm - Just a Test: äöüÃÃÃ
perl v5.10.0 2008-10-16 MyMod(3)
Soluzione
Usa = encoding utf-8
come prima direttiva POD nel tuo file e usa un perldoc
abbastanza recente (ad esempio da 5.10-maint). Quindi dovrebbe funzionare.
Altri suggerimenti
Trovato questo biglietto RT .... http: // rt .cpan.org / Public / Bug / display.html? id = 39000
Questo " bug " sembra essere stato introdotto con Perl 5.10 e forse questo pod2man --utf8 deve essere usato.
perldoc -t MyMod.pm
Dal manuale di perldoc:
-t Visualizza pod usando pod2text invece di Pod :: Man e groff (-t è l'impostazione predefinita su win32 a meno che non sia specificato -n)