From: James Edward Gray II Date: 2009-09-03T00:15:35+09:00 Subject: Re: Ruby1.9: Encoding problems (how to use #force_encoding ?) On Sep 2, 2009, at 9:59 AM, Iñaki Baz Castillo wrote: > 2009/9/2 Axel Etzold : >> Dear Iñaki, >> >> maybe you can use CGI.escape for your encoding problems? >> >> I fetched the Spanish wikipedia page for Alarcón like so: >> >> # encoding: utf-8 >> >> require "cgi" >> require 'open-uri' >> >> search_what=CGI.escape("Alarcón") >> page="http://es.wikipedia.org/w/index.php?title=Especial%3ABuscar&search=#{search_what}&fulltext=Buscar >> " >> open(page){ |f| print f.read } > > Thanks but the problem is that the geo_location Ruby gem returns a > wrong string (encoded in ASCII-8BIT) since it contains invalid chars > for ASCII-8BIT encoding, so Ruby fails when trying to convert it to > other encoding :( There are no invalid characters in ASCII-8BIT. It's a catch all Encoding. So that's definitely not the problem… ;) James Edward Gray II