Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
converting multi-byte strings on Windows?
John Griffiths
1/16/2009 6:44:00 PM
basically i'm reading in a csv file in Windows and it contains a lot of
multi-byte data (squigles, male-female signs etc.), now it's going to be
passed to mysql to insert into the database but because of these weird
characters it screws up the "fdsfdsf" in the queries and breaks the
operation.
Any ideas how to get this data into something like ascii or proper
unicode.
i've tried these...
data.gsub(/[â??]/, '\\\\\â??')
Iconv.iconv("UTF-8", "UTF-8", data)
HTMLEntities.encode_entities(data)
but no dice, i'm probably doing things wrong but would love to know a
proper way around this ?
stuck and in need of advice?
--
Posted via
http://www.ruby-...
.
1 Answer
John Griffiths
1/19/2009 12:29:00 AM
0
think i solved it,
puts Iconv.iconv('US-ASCII//TRANSLIT', 'utf-8',s).to_s
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
converting multi-byte strings on Windows?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password