Hello,
I’m having some problems with iconv. I’m trying to convert (as an
example) http://www.atame.org/a/abel_velazquez/ from iso-8859-1 to utf8.
If I use this on the command line: ‘iconv -f iso-8859-1 -t utf8
index.html’ it works fine. But the following code:
require 'open-uri’
require ‘iconv’
open(“http://www.atame.org/a/abel_velazquez/”) do |f|
puts Iconv.conv(“iso-8859-1”, “utf8”, f.read)
end
returns:
iconv.rb:7:in `conv’: "\341zquez\n "… (Iconv::IllegalSequence)
I’m not sure why this would be. This is on ruby 1.8.1 (2004-02-06) [i686-linux-gnu]
I had dblack try it and he got the same result.
···
–
Zachary P. Landau kapheine@hypa.net
GPG: gpg --recv-key 0x24E5AD99 | http://kapheine.hypa.net/kapheine.asc
Oy nevermind. dblack informed me that it should have been
Iconv.conv(“utf8”, “iso-8859-1”, f.read) not the other way around.
···
On Wed, Mar 17, 2004 at 10:49:57AM +0900, Zachary P. Landau wrote:
Hello,
I’m having some problems with iconv. I’m trying to convert (as an
example) ABEL VELAZQUEZ Tabs: Acordes de Guitarra from iso-8859-1 to utf8.
If I use this on the command line: ‘iconv -f iso-8859-1 -t utf8
index.html’ it works fine. But the following code:
require ‘open-uri’
require ‘iconv’
open(“ABEL VELAZQUEZ Tabs: Acordes de Guitarra”) do |f|
puts Iconv.conv(“iso-8859-1”, “utf8”, f.read)
end
returns:
iconv.rb:7:in `conv’: "\341zquez\n "… (Iconv::IllegalSequence)
I’m not sure why this would be. This is on ruby 1.8.1 (2004-02-06) [i686-linux-gnu]
I had dblack try it and he got the same result.
–
Zachary P. Landau kapheine@hypa.net
GPG: gpg --recv-key 0x24E5AD99 | http://kapheine.hypa.net/kapheine.asc