perl-unicode

Re: DBD:ADO, DBI and UTF-8 (was: dbi and utf8)

2003-12-07 18:30:04
On Sun, 7 Dec 2003 17:10:48 +0100, Stefan Ram 
<ram(_at_)zedat(_dot_)fu-berlin(_dot_)de>
wrote:

 (Intro: The problem is how to retrieve a unicode
 character from a Jet-Database using DBI and DBD-ADO.)

On Sat, Dec 06, 2003 at 11:47:51PM +0800, Autrijus Tang wrote:
Hence, you'd need to explicitly convert bytestrings returned by
DBI into ustrings, using either utf8::decode, or Encode::decode_utf8.

 Thank you, I have tried this in several ways (listing below).

 It always seems as if the Unicode character 
025A   602     LATIN SMALL LETTER SCHWA WITH HOOK
 contained in the Jet-Database can not be converted
 into anything anymore, because the information has
 already be lost. Possibly due to some driver "converting"
 it to ISO-8859-1.

DBD::ADO uses Win32::OLE internally to talk to ADO, and Win32::OLE assumes
that all your data is in Latin 1.  I added UTF8 support some time ago, but
you have to explicitly ask for it because changing the default wouldn't
have been backwards compatible, especially for Perl 5.6.  Try adding the
following line to your program (somewhere after the "use DBD::ADO" line):

 Win32::OLE->Option(CP => Win32::OLE::CP_UTF8); 

Cheers,
-Jan

<Prev in Thread] Current Thread [Next in Thread>