in reply to utf-8 problem

You may find HTML::Entities useful.

Replies are listed 'Best First'.
Re^2: utf-8 problem
by Anonymous Monk on Jan 29, 2009 at 22:16 UTC
    The file that the program reads is a tab delimited file with the first item being the special character and the second item being the html equivalent. Here is the file:
    à Á á á Ã É Ã© Í; í í Ã Ñ Ã± ñ Ã Ó Ã³ ó Ã Ú Ãº ú Ã Ü Ã¼ ü ¿ ¿ ¡ ¡
      How about this?
      use HTML::Entities; use Encode; my $s1 = 'El supersónico de los Indi'; print "Start string: $s1\n"; my $s2 = encode_entities(decode('utf8', $s1)); print "End string: $s2\n";
      1. eff_i_g has pointed out a nice wheel for you.
      2. I strongly suspect the file on your hard drive is not formatted like you think it is.

      That doesn't look like proper UTF-8 to me — though that might merely be a result of the various transformation steps involved in getting the file posted here.

      It would be better if you could show a hex dump of the file. For example, if you're on Linux, there's typically a tool called "hexdump" available, which you could use...