Is there any library to detect charset of the string?
Here is how i'm converting strings
var b:ByteArray = new ByteArray();
b.writeMultiByte(str,to_charset);
return b.toString();
The problem starts when str is already windows-1251 and to_charset is windows-1251 as well. After second conversion it's doing something strange:
Русский -> Ðóññêèé
http://www.artlebedev.ru/tools/decoder/
Decoder here shows Ðóññêèé it's CP1252 → CP1251