I am not enough of an expert in this but the UC/CU modifiers are (already!) deprecated and will be removed from future versions. I think they are not even in 5.7. The 2 preferred ways of converting are using Unicode::String or using Text::Iconv if your system supports the iconv function (try iconv --list to check out if it's on your system and for a list of supported character sets, I believe UTF8 or UTF-8 and LATIN1 or ISO_8859-1) or ISO_8859-1:1987 are the codes you want to use.

I also found an other way to do utf8->latin1 transcoding, which does not require any additional module. But first a warning:

Warning: Calgo-Cult programming follows.

Here is the utf8 to latin1 conversion used in XML::TiePYX. I don't pretend I really know what's going on there.

sub encode { my ($text)=@_; $text=~s/\x0a/\\n/g; $text=~s{([\xc0-\xc3])(.)}{ my $hi = ord($1); my $lo = ord($2); chr((($hi & 0x03) <<6) | ($lo & 0x3F)) }ge; return $text; }

In reply to Re: UTF8 to Latin-1 and back using Perl-6 by mirod
in thread UTF8 to Latin-1 and back using Perl-6 by kavita

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.