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

Re: BOMs as noncharacters

Thread Previous
From:
Johan Vromans
Date:
August 18, 2011 08:58
Subject:
Re: BOMs as noncharacters
Message ID:
m2ippuvhjj.fsf@phoenix.squirrel.nl
Leon Timmermans <fawaka@gmail.com> 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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About