Hi,
I have wondered which is the best way in Ruby to deal with strings in
different encodings. E.g. if I have an input file in “UTF-8” encoding
and I would like to produce an output file in “ISO-8859-2” (central
European) encoding (given that the file with the UTF-8 encoding does not
contain characters which cannot be displayed in the ISO-8859-2 encoding,
of course).
In Python I could solve the problem quite elegant using UTF strings, and
the encode-decode functions.
E.g.
value.decode(‘UTF-8’) (load from UTF-8 encoding)
value.encode(‘ISO-8859-2’) (save to ISO-8859-2 encoding)
What do you recommend to achieve the same effect in Ruby?
Thank you,
Gabor