Re: Copious warnings from Sys::Syslog
[p5sagit/p5-mst-13.2.git] / lib / encoding.pm
index 1504a92..441be33 100644 (file)
@@ -52,10 +52,15 @@ encoding - pragma to control the conversion of legacy data into Unicode
 
     print "tera\n" if ord(pack("C", 0xdf)) == 0x3af;
 
-    # but pack/unpack are not affected, in case you still
+    # ... as are eq and cmp ...
+
+    print "peta\n" if "\x{3af}" eq  pack("C", 0xdf);
+    print "exa\n"  if "\x{3af}" cmp pack("C", 0xdf) == 0;
+
+    # ... but pack/unpack C are not affected, in case you still
     # want back to your native encoding
 
-    print "peta\n" if unpack("C", (pack("C", 0xdf))) == 0xdf;
+    print "zetta\n" if unpack("C", (pack("C", 0xdf))) == 0xdf;
 
 =head1 DESCRIPTION
 
@@ -95,6 +100,10 @@ If no encoding is specified, the environment variable L<PERL_ENCODING>
 is consulted.  If that fails, "latin1" (ISO 8859-1) is assumed.  If no
 encoding can be found, C<Unknown encoding '...'> error will be thrown.
 
+Note if you want to get back to the original byte encoding, you need
+to use things like I/O with encoding discplines (see L<open>) or the
+Encode module, since C<no encoding> (or re-C<encoding>) do not work.
+
 =head1 KNOWN PROBLEMS
 
 For native multibyte encodings (either fixed or variable length)
@@ -102,6 +111,7 @@ the current implementation of the regular expressions may introduce
 recoding errors for longer regular expression literals than 127 bytes.
 
 The encoding pragma is not supported on EBCDIC platforms.
+(Porters wanted.)
 
 =head1 SEE ALSO