It's UCS-2le. UTF-16le, a superset of UCS-2le, also works. (Case doesn't matter.) You should use UTF-16le when reading. You could use UCS-le for writing if you wanted to be strict, but UTF-16le should be fine too. (Just be aware that UTF-16 is a variable-width encoding, so there might be some differences of opinion as to how long a string is.)
Note that Perl might mangle some characters due to the unfortunate order in which the :crlf layer is placed in relation to the :encoding layer. You can avoid that problem using
# Preserve CRLF open(my $fh, '<:raw:perlio:encoding(UTF-16le)', ...) # CRLF->LF open(my $fh, '<:raw:perlio:encoding(UTF-16le):crlf', ...)
In reply to Re: Perl to Read/Write Window Unicode Text files
by ikegami
in thread Perl to Read/Write Window Unicode Text files
by maylin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |