From: Alejandro Michelin salomon <amichelins@gmail.com>
Reply-To: <ruby-talk@ruby-lang.org>
Newsgroups: comp.lang.ruby
Date: Thu, 19 Feb 2009 22:04:38 +0900
To: ruby-talk ML <ruby-talk@ruby-lang.org>
Subject: Problem with special charactersHi:
O.S Windows XP sp3
Ruby 1.8.6I am working with ruby using DBI::Mysql, and the returned descriptions
are not displayed ok. The puts command is displaying wrong characters,
when the text has special chars like á.
[snip]
How to display the text with special characters like 'ç ú í' tha are
used commonly in latin languages?
--
Posted via http://www.ruby-forum.com/\.
I am facing a similar issue on Mac OS X where the TextMate console can only
use UTF8 encoding (The Mac terminal can be set to any encoding).
I asked a similar question to the TextMate mailing list, and I got a useable
workaround. Here is a very small program reading and printing the content of
a text file encoded in ISO-8859-1:
require "iconv"
file = File.open("test.txt", "r")
file.each {
>line>
print line
print Iconv.iconv("UTF-8","LATIN1",line)
}
file.close
So I guess you can use the iconv library to convert in whichever direction
you may need.
Regards,
JD