Subject Re: [firebird-support] Re: UTF8, malformed string error
Author Martijn Tonies
Hi Roman,

Thanks for taking the time - still not finished though ;)

> > Well, explicitly calling an "long string to UTF8 string" works, the
> > strings get inserted.
> >
> > Reading them fails and gets you wrong charactersets, IBO doesn't
> > seem to support all that UTF8 stuff.
>
> You have to call "UTF8 string to long string" conversion routine then :)

But in the ideal case, it would be the IBO layer that does that? Or
should I detect "UTF8" and do the conversion? How does the JayBird
driver do this? Basically, I'm feeding it plain strings, not encoded ones.

> > What does Firebird expect here? Should clients transform the server
> > side chars to something at the client? I guess, when they request it
> > from the server with UTF8, it retursn them as such. I just connected
> > with ISO8859_1 and now the strings are returned correctly, so that
> > would be a server side translation, correct?
>
> Firebird will translate characters from the charset of the particular
> field (or default db charset) into the charset that was specified in
> lc_ctype property in DPB. If nothing was specified, lc_ctype=NONE and
> data are stored and read "as is" (note, very likely it won't work for
> new UTF8 charset, though UNICODE_FSS will "swallow" it).

Right, so in the case above, I'm getting a normal string in my TField
definitions because Firebird translated it for me.

> > Either way -- there's another problem.
> >
> > How do I know when to call these, given the generic nature of this
> > application?
>
> Specify the lc_ctype when connecting to the database. If all your
> applications do this and database has correctly specified charsets in
> fields, you will always obtain data according to your lc_ctype.

My applications support supplying the characterset, but they don't
call any conversion routines, so what you're saying is that by using
the charset when connecting, I'm telling Firebird that I'm sending
UTF8 strings, while I'm not. Correct?


Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com