As Daxim points out, I was misled. =encoding=UTF-8 and =encoding=UTF-8 use strong encoding, and =encoding=utf8 is soft encoding:
$ cat enc-test.pod =encoding ENCNAME =head1 TEST '\344\273\245\376\202\200\200\200\200\200' =cut
(here \xxx means a literal byte with the value xxx . \344\273\245 is a valid UTF-8 sequence, \376\202\200\200\200\200\200 not)
=encoding=UTF-8 :
$ perl -pe 's/ENCNAME/utf-8/' enc-test.pod | pod2cpanhtml | grep /h1 >TEST &
=encoding=utf8 :
$ perl -pe 's/ENCNAME/utf8/' enc-test.pod | pod2cpanhtml | grep /h1 Code point 0x80000000 is not Unicode, no properties match it; ... Code point 0x80000000 is not Unicode, no properties match it; ... Code point 0x80000000 is not Unicode, no properties match it; ... >TEST &
All of them are equivalent. The =encoding argument is expected to be the name recognized by the Encode::Supported module. When you go to this document, you see
- canonical encoding name
utf8 - the
UTF-8 name is an alias for utf8 and - names are case insensitive, therefore
UTF-8 equivalent to UTF-8
What is the best practice? I'm not sure. I do not think that you are mistaken using the official IANA name (according to daxim's answer), but you also cannot be mistaken in the official Perl documentation.
source share