At 7:32 pm +0100 17/2/05, Philippe de Rochambeau wrote:
I am trying to convert MacRoman encoded text to iso-8859-1. The script below show what I am trying to do.
The input file, data.txt contains the following string:
Les �l�phants sont arriv�s. <EURO>
First of all iso-8859-1 does not contain the Euro sign. The character set you probably intend is Windows-1252, loosely termed "Windows Latin 1" in OS X menus. Unfortunately Perl has a pretty loose approach to charset names too, though when it says iso-8859-1 it means it and not any extended version of it.
Try this. It works here with Perl 5.8.6:
#!/usr/bin/perl -w use encoding "MacRoman", STDOUT => "windows1252"; chdir "$ENV{HOME}/temp/"; open STDIN, "<mac.txt" or die $!; open STDOUT, ">windows1252.txt"; while ( <> ) { print; }
JD
