Problem with DB and Char size (2)

Krasimir Angelov kr.angelov at gmail.com
Thu Jan 27 09:23:52 EST 2005


HSQL uses withCString internally. withCString strips the higher order
bytes from Char.


On Thu, 27 Jan 2005 15:11:38 +0100, Santoemma Enrico
<enrico.santoemma at beta80group.it> wrote:
> Oops... I hit the wrong key, sending a partial post. Sorry :)
> 
> Again:
> I have a problem with strings and unicode chars, when writing slq statements on Oracle ODBC driver through HSQL.
> I'm writing here because I suspect that a fix could come from writing 8 bit strings, if it is possible somehow.
> 
> I'm sorry, the problem is very deep into it's context, and I know it's not easy to follow the reasoning.
> These are the facts:
> - I execute an SQL statement, an INSERT, where some values come from a web browser, and are UTF-8 encoded
> - Oracle ODBC expects UCS-2, so it converts the values into UTF-8, of course scrambling the data
> - when I convert, in Haskell, UTF-8 to UCS-2, I see that someone (perhaps HSQL) strips one byte from the two Char's bytes, so again Oracle receives bad data
> 
> As I haven't found how to force the driver not to strip the byte, and also I don't like to convert data two times, I'd try to send 8 bit strings, but don't know how.
> Is Word8 a solution? If it is, what is the contstructor?, as w = W8# 1 doesn't compile.
> 
> I'm weak on low level Haskell. Where do I find references? On the Report?
> 
> Thanks,
> Enrico
> 
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>


More information about the Glasgow-haskell-users mailing list