24

我需要在我的 perl 文档中使用 utf-8 字符。如果我使用:

perldoc MyMod.pm

我看到奇怪的字符。如果我使用:

pod2text MyMod.pm

一切安好。

我使用 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

是否有关于在 Pod 中使用特殊字符的 HowTo?

这是一个使用德语变音符号“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)
4

3 回答 3

19

用作文件中的第一个 POD 指令,并使用=encoding utf-8相当新的perldoc(例如来自 5.10-maint)。然后它应该工作。

于 2008-10-16T14:04:48.463 回答
6

找到这张 RT 票.... http://rt.cpan.org/Public/Bug/Display.html?id=39000

这个“错误”似乎是在 Perl 5.10 中引入的,也许需要使用这个 pod2man --utf8 。

于 2008-10-16T10:32:46.957 回答
0

perldoc -t MyMod.pm

从 perldoc 手册:

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

于 2017-05-17T08:38:12.990 回答