E
Emmanuel Touzery
Hello,
I'm reading data from different encodings (web pages), i first
thought about converting all to unicode, but it's not handy right now in
ruby. Then i thought i might as well convert it all to my local encoding
for easy processing in ruby (uppercase, regexps etc) [1]. it's easy to
hardcode my local encoding in the app, but i'd like to make it generic,
to work at my work (windows, cp1250) and at home (linux, iso8859-2).
Hence the question: how can i get a string of my local encoding, on
linux or windows? or how do i tell iconv "convert to my local encoding"?
thank you,
emmanuel
[1] i thought about it late, because i didn't think latin2 has so many
chars from latin1 as it does; many times the conversion would be successful.
encoding for the computer in a portable (unix/windows) way?
emmanuel
I'm reading data from different encodings (web pages), i first
thought about converting all to unicode, but it's not handy right now in
ruby. Then i thought i might as well convert it all to my local encoding
for easy processing in ruby (uppercase, regexps etc) [1]. it's easy to
hardcode my local encoding in the app, but i'd like to make it generic,
to work at my work (windows, cp1250) and at home (linux, iso8859-2).
Hence the question: how can i get a string of my local encoding, on
linux or windows? or how do i tell iconv "convert to my local encoding"?
thank you,
emmanuel
[1] i thought about it late, because i didn't think latin2 has so many
chars from latin1 as it does; many times the conversion would be successful.
which made me wonder: how do I find out what is the current localEmmanuel said:a string is considered by ruby as encoded as <insert your locale
here>. If you want to treat strings from other encodings, you can
convert encoding using "iconv" (bundled with ruby 1.8); in your case,
you can use iconv to convert the string to your local encoding
(iso-8859-1) and then capitalize will work fine.
encoding for the computer in a portable (unix/windows) way?
emmanuel