X
Xavier Noëlle
Hello,
I'm trying to deal with Ruby flaws with encoding, which I thought
would be almost past with Ruby 1.9. I managed to find a solution for
Ruby 1.8 and thought I did for Ruby 1.9...but in fact, no !
I fetch rows from an UTF8 database and try to work with the string. To
do so, I would like it to be UTF8 encoded.
"str.encoding()" gives me "ASCII-8BIT"...so, I thought one of these
lines would solve the problem
str.replace(Iconv.iconv("UTF8", "ascii", self).join())
OR
self.encode!('UTF-8')
But they don't !
First one: in `iconv': "\xE8te pour luth" (Iconv::IllegalSequence)
Second one: in `encode!': "\xE8" from ASCII-8BIT to UTF-8
(Encoding::UndefinedConversionError)
The base string is "Oeuvre compl=E8te pour luth" and displays well in PHPMy=
Admin.
Any idea ?
TIA,
--=20
Xavier NOELLE
I'm trying to deal with Ruby flaws with encoding, which I thought
would be almost past with Ruby 1.9. I managed to find a solution for
Ruby 1.8 and thought I did for Ruby 1.9...but in fact, no !
I fetch rows from an UTF8 database and try to work with the string. To
do so, I would like it to be UTF8 encoded.
"str.encoding()" gives me "ASCII-8BIT"...so, I thought one of these
lines would solve the problem
str.replace(Iconv.iconv("UTF8", "ascii", self).join())
OR
self.encode!('UTF-8')
But they don't !
First one: in `iconv': "\xE8te pour luth" (Iconv::IllegalSequence)
Second one: in `encode!': "\xE8" from ASCII-8BIT to UTF-8
(Encoding::UndefinedConversionError)
The base string is "Oeuvre compl=E8te pour luth" and displays well in PHPMy=
Admin.
Any idea ?
TIA,
--=20
Xavier NOELLE