in reply to Encoding issue

The test.txt has the characters Limón. How to avoid the characters converting to this way.

There is no converting. You need to view test.txt with something capable of interpreting its encoding, if its ASCII or UTF-8

Replies are listed 'Best First'.
Re^2: Encoding issue
by Anonymous Monk on Mar 30, 2010 at 09:47 UTC
    LWP wont change the encoding, but your console might display weird stuff, for example cmd.exe displays
    $ chcp Active code page: 437 $ echo Limón |od -tacx1 0000000 L i m " n sp sp cr nl L i m ó n \r \n 4c 69 6d a2 6e 20 20 0d 0a 0000011 $ perl -le" print for @ARGV" Limón |od -tacx1 0000000 L i m s n cr nl L i m ≤ n \r \n 4c 69 6d f3 6e 0d 0a 0000007 $ perl -le" binmode STDOUT, ':encoding(cp437)'; print for @ARGV" Limón + |od -tacx1 0000000 L i m " n cr nl L i m ó n \r \n 4c 69 6d a2 6e 0d 0a 0000007 $ perl -le" binmode STDOUT, ':encoding(UTF-8)'; print for @ARGV" Limón + |od -tacx1 0000000 L i m C 3 n cr nl L i m ├ │ n \r \n 4c 69 6d c3 b3 6e 0d 0a 0000010 $
      I am opening the file
      open (FILEHANDLE, ">:encoding(iso-8859-1)", "$files");
      But still the problem doesn't solve.
        Why would it solve the problem?