We have a database dump that is (mostly) in iso-8859-01 or more likely in windows 1252. The database was populated by a web form that encouraged browsers to give us text in these charsets because it's head section included:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1 +">

...and Internet Exploder interprets iso-8859-01 as license to give you Windows 1252

We are converting to utf-8 , becasue it is clearer and better supports non-English characters

The somewhat simplified code is

use Encode qw(from_to); binmode DATA, ':utf8'; my $original=<DATA>; my $converted=$original; from_to($converted,'iso-8859-01','utf-8'); from_to($converted,'utf-8','iso-8859-01'); print $converted eq $original?'round trip ok':'changed'; __DATA__ some chars that in reality aren't all low ascii

Our problem is that our utf-8 output doesn't show up correctly in the terminal. As near as we can tell from the  locale command and the Terminal->Set Character encoding menu item in gnome-terminal

For example, some of our converted output in utf8 contains a bunch of 0xC2 and 0xC3 (194 & 195) chars

perl -e 'binmode STDOUT,":utf8"; print chr(0xC2),"\n";'

...Gives a LATIN CAPITAL A WITH CIRCUMFLEX (according to gnome-character-map), which is not in the input.

maybe we don't know what char set the input is in?

UPDATE: set binmode per Anonymous Friend


In reply to display of utf8 by omacneil

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.