develooper Front page | perl.perl5.porters | Postings from August 2011

Re: BOMs as noncharacters

Thread Previous
Johan Vromans
August 18, 2011 08:58
Re: BOMs as noncharacters
Message ID:
Leon Timmermans <> writes:

> The word «some» is exactly why this is not a particularly good idea.

That is why I suggested:

>>  use open IN => ':encoding(auto)' OUT => ':encoding(UTF-16LE+BOM)';

This can bail out elegantly (or hard) when the file does not have a BOM.

One might even add a fallback to UTF-8 and bail out upon detection of
invalid UTF-8 sequences. This will deal with any environment where
ASCII, UTF-8 and BOM files are dominant. Which, as I assume, will be
most environments in the near future.

-- Johan

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About