As moritz points out, if you don't know what encoding is being used in the file, then you don't really know how to open the file.
If you're actually dealing with a bunch of different files that may be in different encodings, then Encode::Guess is probably the only way to go. But if the input is known to be consistent, maybe you just need to figure out once what the encoding is, and write your script to handle that encoding.
There really aren't very many different choices when it comes to French; "é" in a single-byte encoding might be either 0x82 (older PC code pages with 3-digit numbers, eg. CP437, CP720, etc), 0x8E (older Mac code pages) or 0xE9 (various iso-8859-n and Windows CP125n).
In multi-byte form, it's most likely unicode (0xC3 0xa9 in utf8, or 0x00E9 in utf-16 -- but this latter could be either big- or little-endian).
Just use some sort of hex dump tool on your file to see what it is, and use the proper encoding as an IO layer when opening the file:
open( my $fh, "<:cp1252", "file.name" ) or die $!; # assuming it's cp +1252
In reply to Re: Reguar expressions and french characters
by graff
in thread Reguar expressions and french characters
by wardazo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |