Re: Use of encoding/decoding and 3-param open

[email protected] (Paul Bijnens) Thu, 15 Nov 2007 14:52:22 +0100
Newsgroups perl.unicode
Message-ID <[email protected]>
On 2007-11-13 19:56, Juerd Waalboer wrote:
> 
>> $rv = open (OUT2, ">:utf8", "sample2");
> 
> Should work well. Remember that you shouldn't use :utf8 for input. In
> the general case, :encoding(UTF-8) is safest.

Can you elaborate more on the subtle difference between:

   binmode(STDIN, ":utf8");
   binmode(STDIN, ":encoding(UTF-8)");

besides that "UTF-8" is narrower than "utf8", as explained in the
man page of "Encode" (section: "UTF-8 vs. utf8").
For output, some codepoints allowed by "utf8" would raise an error in 
"UTF-8".
For input, both get the correct characters, assuming the input 
bytestream was indeed correct.  Or am I missing something?

-- 
Paul Bijnens, xplanation Technology Services        Tel  +32 16 397.511
Technologielaan 21 bus 2, B-3001 Leuven, BELGIUM    Fax  +32 16 397.512
http://www.xplanation.com/          email:  [email protected]
***********************************************************************
* I think I've got the hang of it now:  exit, ^D, ^C, ^\, ^Z, ^Q, ^^, *
* F6, quit, ZZ, :q, :q!, M-Z, ^X^C, logoff, logout, close, bye, /bye, *
* stop, end, F3, ~., ^]c, +++ ATH, disconnect, halt,  abort,  hangup, *
* PF4, F20, ^X^X, :D::D, KJOB, F14-f-e, F8-e,  kill -1 $$,  shutdown, *
* init 0, kill -9 1, Alt-F4, Ctrl-Alt-Del, AltGr-NumLock, Stop-A, ... *
* ...  "Are you sure?"  ...   YES   ...   Phew ...   I'm out          *
***********************************************************************