On Thu, Feb 2, 2012 at 6:54 AM, Jeremy Evans <[email protected]> wrote:
> On Feb 1, 2:22 pm, Christian MICHON <[email protected]>
> wrote:
>> On Wed, Feb 1, 2012 at 6:45 PM, Jeremy Evans wrote:
>> > On Feb 1, 7:24 am, Christian MICHON wrote:
>> >> Hi,
>>
>> >> I've a small app running on jruby and sequel, accessing H2 embedded
>> >> databases through jdbc.
>>
>> >> I've plenty of germanic letters (like 0xD6 capital o with umlaut) I
>> >> would need in my records, but when it goes as part of a string into my
>> >> H2 db, I cannot get back the original content through queries.
>>
>> >> How to perform this? I am currently using jruby in 1.8 mode, and
>> >> moving to 1.9 (in order to use force encoding plugin for example) is
>> >> not an option yet.
>>
>> > Can you submit a self-contained example showing the problem,
>> > preferably with an SQL log?  Note that Sequel doesn't monkey with
>> > string encodings (unless you use the force-encoding plugin), and if
>> > you are getting bad results in 1.8 mode, it may be due to lower layers
>> > of the stack (jdbc, java, h2).
>>
>> sure Jeremy!
>>
>> You can find both source code and output in the following 
>> pastie:http://pastie.org/3298600
>>
>> SQL log looks fine, which might mean it's H2 related. Not sure yet
>> what is wrong here...
>>
>> More info on my setup:
>> * jruby 1.6.6 (ruby-1.8.7-p357) (2012-01-30 5673572) (Java HotSpot(TM)
>> Client VM 1.6.0_29) [Windows Vista-x86-java]
>> * H2 1.3.162 (2011-11-26)
>> * sequel 3.31.0
>
> I'll do some troubleshooting on this tomorrow, but it doesn't appear
> to be caused by Sequel.  My guess is h2 is translating it to unicode
> internally, and returning it in UTF-8 format.
>

Thanks. I also did some experiments this morning.

Based on the log I attached in the pastie above, I tried to enter
exactly the sql commands straight into H2 console, to see if H2 was
responsible or not.

Please note that logger reported sequel inserting the right content...

CREATE TABLE IF NOT EXISTS "WORDS" ("ID" identity PRIMARY KEY, "TEXT"
varchar(255));
Update count: 0
(0 ms)

BEGIN;
Update count: 0
(10 ms)

INSERT INTO "WORDS" ("TEXT") VALUES ('fötter');
Update count: 1
(0 ms)

SELECT IDENTITY();
IDENTITY()
1
(1 row, 10 ms)

SELECT * FROM "WORDS" WHERE ("ID" = 1) LIMIT 1;
ID      TEXT
1       fötter
(1 row, 0 ms)

COMMIT;
Update count: 0
(0 ms)

SELECT * FROM "WORDS" LIMIT 1;
ID      TEXT
1       fötter
(1 row, 0 ms)

So I believe there might be a mismatch between what the logger
reported and what truly was inserted in H2.

-- 
Christian

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to