Unicode and Sybase univarchar

[email protected] (Dave Rolsky)
Newsgroups perl.dbi.users
Message-ID <[email protected]>
I'm working on an i18n project, and we use Sybase (sigh).

Newer versions of Sybase have built-in support for Unicode with the 
univarchar (and other uni*) type.

However, it seems like DBD::Sybase doesn't have any support for this.

Specifically, if I take a Perl unicode string (utf8 flag is on) and insert 
it in a univarchar column, it seems to be inserted as raw bytes (or 
something).

What's really bizarre is that when I select the value back I get something 
like "0065006d00200064006100730068003a002000e200800094".

Yes, that's a literal string containing a series of 2-digit hex numbers!

I can translate this back to Perl unicode with this madness:

     my $chars = do {
         use bytes;

         join q{}, map { chr( eval '0x' . $_ ) } $fromdb =~ /(....)/g;
     };

     my $unicode = decode( 'utf8', $chars );

So the data is there, but not in a very usable form.

Has anyone researched or solved this problem?

Michael Peppler, if you're reading this, is there any work on supporting 
Perl's unicode format transparently in DBD::Sybase?

My employer might be able to pay to have this work done, if you're 
interested. Alternately, maybe you could give me some hints and I could 
try to figure it out.


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