Re: Unicode and Sybase univarchar

[email protected] (Dave Rolsky)
Newsgroups perl.dbi.users
Message-ID <[email protected]>
On Thu, 3 Jun 2010, Alexander Foken wrote:

> Really strange way to avoid pack()/unpack(). At least, you can get rid of the

Yes, yes, this is hack code, not production.

> ... should just work. It doesn't quite, because the hex string is not just a 
> dump of a 16 Bit Unicode encoding, but it is a UTF-8 byte stream written with 
> a 16 Bit Hex Format for each byte. Each and every 16-Bit-Word has its most 
> significant byte set to 0.
>
> If it was a dump of a 16 Bit Unicode encoding, it should read
> "0065006d00200064006100730068003a00202014"
> and not
> "0065006d00200064006100730068003a002000e200800094"
>
> Your call to decode() compensates that, probably because you encoded once too 
> much before writing the data into the database.

I did not encode at all. I simply created a utf8 string in Perl land and 
inserted it into Sybase.

Really, DBD::Sybase needs to handle any character set translation, not the 
end user.


-dave

/*============================================================
http://VegGuide.org               http://blog.urth.org
Your guide to all that's veg      House Absolute(ly Pointless)
============================================================*/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.