As UTF-8 contains lots and lots of characters, and Latin-1 only contains 256 different characters, some of which aren't considered "printable", you cannot do a lossless conversion from UTF-8 down to Latin-1. Using Encode::encode should Just Work still, and either die or replace the unmappable characters to "?". But without any code, it's hard to tell where your attempt goes wrong.

If you want to map arbitrary Unicode to ASCII, there also is Text::Unidecode. But it will map for example \N{SMALL LETTER A WITH DIERESIS} ("ä") to "a", even though "ä" also exists in Latin-1.


In reply to Re: Converting UTF8 to Latin1 by Corion
in thread Converting UTF8 to Latin1 by sumeetgrover

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.