[EMAIL PROTECTED] said:
> Hello All, I'm using utf-8 Postgres database, where I save strings in
> many languages. I have to match the database with strings encoded in
> mime base64 or  quoted-printable format. Like next:
> =?utf-8?B?15TXoNeUINee16nXlNeZINeR16LXkdeo15nXqi4=?= or
> =?KOI8-R?Q?=F0=D2=C9=D7=C5=D4=2C_=ED=C9=D2!!!?=
>
> I think that I need first convert these strings to utf-8, but I can
> not  find out how to do it. 

I'm not sure what to make of the second data sample, but the first 
would make sense to me if treated as follows:

use Encode;
use MIME::Base64;

$s = "15TXoNeUINee16nXlNeZINeR16LXkdeo15nXqi4="; # removed non-base64 stuff

$d = decode_base64( $s );

$u8 = decode( "utf8", $d );

print $u8,$/;  # this is the data rendered as utf8 characters

$u16 = encode( "UTF-16BE", $u8 );

print $u16,$/; # this is the same data rendered as UTF-16BE characters

__END__

If I was right about your first sample, it's a string in Hebrew, 
arranged as follows:

U05e0 U05d4 <space> U05de U05e9 U05d4 U05d9 <space>
 U05d1 U05e2 U05d1 U05e8 U05d9 U05ea U002e

(That last character is just the plain ascii "period".)

The second data sample doesn't seem to work this way -- maybe someone 
else knows why...

        Dave Graff


Reply via email to