How can I convert the string from unknown character set which is foreign language to latin1 character set. I am working in ruby 1.8.7.
Asked
Active
Viewed 149 times
1 Answers
0
You can't. You need to know the source encoding.

Jörg W Mittag
- 363,080
- 75
- 446
- 653
-
is there any other method available in ruby 1.8.7 to convert string to laitin-1 ? – jaswinderahuja Mar 17 '17 at 10:07
-
If you don't know the source encoding, then you *cannot possibly* transcode the string. Period. You need to decode the string according to the source encoding, then encode it according to the target encoding. You cannot do that if you don't know the source encoding. This has nothing to do with what method or what library or what language you use. If you don't know the source encoding, you cannot transcode. – Jörg W Mittag Mar 17 '17 at 10:15