in reply to Re^2: Encoding Problem
in thread Encoding Problem

I tried to decode cp1254 encoded data with iso-8859-9, it gave me garbled text.

If you had been asking for errors or warnings from Encode, it would have given you those as well.

Make sure you understand the "superset/subset" relation: cp1254 is a superset of 8859-9 (8859-9 is a subset of cp1254), which means that treating cp1254 data as if it were 8859-9 data is likely to fail, whereas treating 8859-9 data as if it were cp1254 will not fail.

And yes, Encode::Guess was apparently doing the right thing and giving you the correct answer, if the text you gave it happened to actually be 8859-9 (because such text could also be cp1254). But if you gave it single-byte-per-character text that included a lot of bytes in the 0x80-0x9f range, and it said "this could be 8859-9", I would call that a disappointing mistake.