|
|
What about charset?
Hi!
I have a ruby program wich take some information from a .txt file, and
copy it to a sqlite3 table. But the text is in ASCII-8BIT charset, so
when I select the data from the table, it doesn't return the right
characters. What can I do?
Thanks.
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
casanejo (4)
|
5/5/2010 2:04:19 AM |
|
Noé Alejandro wrote:
> I have a ruby program wich take some information from a .txt file, and
> copy it to a sqlite3 table. But the text is in ASCII-8BIT charset, so
> when I select the data from the table, it doesn't return the right
> characters. What can I do?
Show your code, and also which exact versions of ruby, ruby-sqlite3 and
operating system you are using.
Are you sure it doesn't "return the right characters"? How do you know?
Use str.bytes.to_a to be sure, which will show you the actual byte
codes, and compare this str.bytes.to_a for the strings you put into the
database.
Any data you put into sqlite3 should be returned the same. The string
you get back from sqlite3 might be tagged with the wrong encoding (in
ruby 1.9), but it should at least be the same string of bytes.
Furthermore the encoding tag shouldn't affect how they are displayed, at
least if you're using a regular "puts" to write them out, and haven't
started messing with external encoding settings.
--
Posted via http://www.ruby-forum.com/.
|
|
0
|
|
|
|
Reply
|
Brian
|
5/5/2010 7:11:06 PM
|
|
|
1 Replies
3114 Views
(page loaded in 0.224 seconds)
Similiar Articles: What encoding better to select ? - comp.lang.javascriptwhat encoding better to select when paste javascript or php code into windows Notepad and 'Save as'? ANSI, Unicode, Unicode big endian, UTF-8 ? m. The best MP3 VBR bitrate choice when encoding audio? - comp ...My whole life I've been listening to my music on 22.5 KHz 56/64 kbps because it bore little to no difference to the original for me, and cuz I felt li... "Platform default encoding" - comp.lang.java.helpI'm not sure which comp.lang.java.* newsgroup is appropriate. javac documentation at (inter alia) http://download.oracle.com/javase/6/docs/technot... list posts in UTF-8 - comp.protocols.time.ntpI posted my message as text/plain with charset=UTF-8, which has been an IETF standard for more than a decade. And my message does, in fact, appear correct with UTF-8 ... any matlab function/source code for huffman encoding - comp ...Dear all, I am looking for matlab source code for huffman encoding such as those used in JPEG... I hate C code since I guess I need 10x more time to... PDF search / find / copy problem. Associated with character ...Basing on other posts found here I expect font problem (encoding, identity-H?) as a reason. Am I right? Can you give me please a clue what can I do to search through ... SAS/Graph Sizing Problem - comp.soft-sys.sas--B_3372172339_2409990 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Hello, I'm trying out some code from Pete Lund's excellent SGF ... WinAnsiEncoding vs unicode - comp.text.pdfHello! I have seen in a Font object that the directory contains a "Encoding" key. This is the font encoding and I can choose between WinAnsiEncoding,... Live Upgrade error file? - comp.sys.sun.adminThis is an OpenPGP/MIME signed message (RFC 2440 and 3156) -----enig5E0855475EEFF27C197505EC Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer ... Identity-H encoding for CIDFont - comp.text.pdfHi all; I am currently engaged in a project which request me to generate some reports in PDF format, and they contains CJK contents. Can anyone plea... Character encoding - Wikipedia, the free encyclopediaA character encoding system consists of a code that pairs each character from a given repertoire with something elseāsuch as a bit pattern, sequence of natural ... The Absolute Minimum Every Software Developer Absolutely ...It does not make sense to have a string without knowing what encoding it uses. You can no longer stick your head in the sand and pretend that "plain" text is ASCII. 7/24/2012 8:58:03 AM
|
|
|
|
|
|
|
|
|