How do I use Unicode characters in Pod and perldoc?

三世轮回 提交于 2020-01-10 12:10:32

问题


I need to use utf-8 characters in my perl-documentation. If I use:

perldoc MyMod.pm

I see strange characters. If I use:

pod2text MyMod.pm

everything is fine.

I use 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

Is there a HowTo about using special characters in Pod?

Here is a small example using german umlauts "Just a Test: äöüßÄÖ":

$ 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)

回答1:


Use =encoding utf-8 as the first POD directive in your file, and use a fairly recent perldoc (for example from 5.10-maint). Then it should work.




回答2:


Found this RT ticket.... http://rt.cpan.org/Public/Bug/Display.html?id=39000

This "bug" seems to be introduced with Perl 5.10 and perhaps this pod2man --utf8 needs to be used.




回答3:


perldoc -t MyMod.pm

From the perldoc manual:

-t Display pod using pod2text instead of Pod::Man and groff (-t is the default on win32 unless -n is specified)



来源:https://stackoverflow.com/questions/207871/how-do-i-use-unicode-characters-in-pod-and-perldoc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!