in reply to Re: UTF-8 text files with Byte Order Mark
in thread UTF-8 text files with Byte Order Mark
Yeah, this works, except that the BOM indeed is a three-bytes thing as said above. So the code, that seems to work, now looks like this:
while (my $line = <$rulesFH>) { if ($. == 1) { # Remove Byte Order Mark if it's there use Encode; my $octets = encode("utf8", $line); $octets =~ s/^\x{ef}\x{bb}\x{bf}//; $line = decode("utf8", $octets); } # rest... }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: UTF-8 text files with Byte Order Mark
by ikegami (Patriarch) on Feb 13, 2007 at 20:48 UTC | |
by muba (Priest) on Feb 13, 2007 at 21:01 UTC | |
by Anonymous Monk on Sep 30, 2011 at 18:30 UTC | |
by ikegami (Patriarch) on Oct 01, 2011 at 21:53 UTC | |
|