On Jun 3, 2010, at 7:29 PM, Michael Peppler wrote:
> Hi,
>
> Which version of Sybase, which version of Sybase OpenClient, and which
> version of DBD::Sybase?
>
> Are you setting the connection charset to utf8 (in the connect() call?)
>
I just gave this a try - I'm under linux, with ASE 15.5. I created a table with
a univarchar column, entered some data via isql, then wrote a minimal perl
script to fetch the data.
If I use a UTF8 locale (i.e. LANG=en_us.UTF8) I get the correct output.
If I don't I do not get the correct output, at least for rows where non-ascii
data has been entered into the table.
I'm using DBD::Sybase 1.10.
Michael
>
>
> On Jun 3, 2010, at 5:22 PM, Dave Rolsky wrote:
>
>> 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)
>> ============================================================*/
>>
>
> --
> Michael Peppler
> Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html
>
> "A successful [software] tool is one that was used to do something undreamed
> of by its author." -- S. C. Johnson
>
>
>
>
>
>
>
>
--
Michael Peppler
Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html
"A successful [software] tool is one that was used to do something undreamed of
by its author." -- S. C. Johnson