It works fine for characters in the native charset...

# feeder.pl $s = join '', map chr, 0..255; print $s;
# tester.pl $s = join '', map chr, 0..255; 1 while $read = read(STDIN, $in, 512, $ofs+=$read); print($in eq $s ? "pass\n" : "fail\n");
$ perl feeder.pl | perl tester.pl pass $ perl feeder.pl | perl -C6 -pe1 | perl -C1 -pe1 | perl tester.pl pass

... But it doesn't work so well for characters not in the native charset.

$ perl -C6 -e 'print "\x{2660}"' | perl -C1 -pe1 Wide character in print, <> line 1. [junk][junk][junk]

Compare to

$ perl -C6 -e 'print "\x{2660}"' | perl -C1 -MEncode -pe '$_=encode("i +so-latin-1",$_);' ?

Up to the reader to choose if that's good enough.


In reply to Re^2: quick translate utf8 to latin1 encoding by ikegami
in thread quick translate utf8 to latin1 encoding by codeacrobat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.