in reply to Re^2: Decoding bad UTF-16
in thread Decoding bad UTF-16
I switched from "open(FILE, "<:encoding(UTF-8)", $file)" to using decode()
eh? UTF-8?
decode and <:encoding are the same thing.
UTF-16:Unrecognised BOM
When you specify UTF-16, the file must have a BOM. Specify the actual encoding (UTF-16le or UTF-16be) otherwise.
I also tried using USC-2, but I get "illegal unicoded char",
That's not possible. I've just shown you that every possible byte combination is accepted by decode.
Why bytes causes that, and what encoding did you specify, UCS-2le or UCS-2be?
|
|---|