On Fri, Feb 3, 2012 at 1:41 AM, Jeremy Evans <[email protected]> wrote:
> On Feb 2, 1:26 pm, Peter Vandenabeele <[email protected]> wrote:
>> As I noted in this thread
>>
>>  http://www.ruby-forum.com/topic/3496096
>>
>> it may be that using Iconv in ruby gets deprecated
>> and the  functionality is better implemented with
>>
>> Encoding::Converter
>>
>> http://www.ruby-doc.org/core-1.9.3/Encoding/Converter.html
>
> Christian already stated that he could not yet move to 1.9, so that's
> not an option.  Certainly in ruby 1.9, you should be using the
> Encoding facility instead of Iconv, but in ruby 1.8, Iconv is the way
> to go.
>

Interesting links anyway: thanks for sharing them Peter. And as
mentioned again by Jeremy, moving to 1.9 mode is not yet an option.

My target is still to have the right encoded values in H2, so I did
not keep the utf8 as an intermediate format. Using the code share by
Jeremy (to_utf8/from_utf8 using iconv) worked, but the content from H2
console was not the right one.

Instead, I did an insertion in H2 of the right character (therefore
stored as unicode) and used sequel to query that record. This gave me
a specific mapping. I can live with this, as I'm already performing
some filters before insertions.

What I did next was to create to_h2 and from_h2 in the class String.
This is dirty but it works: the content in the db is now the right
one, and my app is happy about it.

You can see a snippet in this pastie: http://pastie.org/3307806

There is still a bug either in jruby, or in jdbc. I validated this
approach solves the issue for jdbc/h2 and jdbc/sqlite over jruby.

I might keep this until I report it to Jruby/JIRA, but I need to
isolate in jruby a snippet showing a wrong encoding happening in
jruby, else the bug will not be considered. I do not have much time
for this until a few days from now, but if Jeremy knows where to point
to inside sequel code, I will have a look at it once less busy.

-- 
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