develooper Front page | perl.perl5.porters | Postings from February 2008

Re: use encoding 'utf8' bug for Latin-1 range

Thread Previous | Thread Next
Juerd Waalboer
February 25, 2008 19:24
Re: use encoding 'utf8' bug for Latin-1 range
Message ID:
Jarkko Hietaniemi skribis 2008-02-25 20:02 (-0500):
> : 4. strongly discourage the use of non-latin1 non-utf8 source code
> On the point 4. I can but disagree.  While I do strongly believe that
> Unicode is a good thing, and UTF-8 is the only sane source code encoding
> of it, I also strongly think that dictating its use is Not The Perl Way.
> Unless Rule 1 says that UTF-8 is the Only Way, we should allow for
> having code (remember, in Perl this includes also things like POD
> and here-docs) in legacy encodings.  The only reason I implemented
> (poorly) the encoding pragma was to support legacy encodings, especially
> the Eastern Asian ones.

In my opinion it is not necessary to support legacy encodings for text
string literals. Whether dictating the use of UTF-8 is Perlish, I have
no idea.

Legacy encodings for text string literals have been supported since 5.8
(year 2002), but the mechanism has never worked in a very usable way:
the behaviour of \x and chr were changed as you noted, and the
assumption that the runtime STDIO environment and the source code would
always use the same encoding made it practically impossible to ever ship
programs written with "use encoding".

I think use of "use encoding" is not at all widespread, and that this is
partly because of the bugs, but mostly because there's very little
demand for it. Of course, I might be mis-assuming, and perhaps
attempting to guess usage patterns is also Not The Perl Way.

Your opinion and my opinion are now known. I wonder if anyone else has
something to add.

P.S. A Google Code search for "use\s+encoding lang:perl" returns only
300 hits, most of which are Perl/Encode documentation/tests. Most of the
other hits have "use encoding 'utf-8';".
Met vriendelijke groet,  Kind regards,  Korajn salutojn,

  Juerd Waalboer:  Perl hacker  <>  <>
  Convolution:     ICT solutions and consultancy <>

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