From: <Mar...@ml...> - 2002-10-17 13:15:52
|
>Hi, >I'm trying to fetch values that are unicode(latin1) encoded, and dump = them into a csv textfile. >I uploaded them myself, and I'm surprised at how difficult I find it t= o retrieve them again >The value I'm interested holds a "=E9". I uploaded in like this : >my $u=3DUnicode::String::latin1($site); >and then used $u as the value of the attribute to be uploaded. >This worked perfect and the values are perfectly readable with an ldap= browser or the console (we're using iplanet DS >here) i think they are readable because the ldap browser encodes unicode= also >Now the question is, how can I get it back in it's original format? >The original word was Br=E9tigny; the way it's stored now is Br=C3=A9t= igny. >It tried using >$site =3D Unicode::String::latin1("$u")->utf8 >and >$site =3D Unicode::String::utf8("$u") >and other combinations, but the problem is I don't even know to what s= pecific format I have to decode the Unicode >to... you should convert the string to iso-8859-1 try the perlmodule Unicode::MapUTF8; following lines will do the work. use Unicode::MapUTF8 qw(from_utf8) $the_latin_encoded_string =3D from_utf8({ -string =3D> $the_u= tf8_string, -charset =3D> "ISO-8859-1" }); sure this only works when the input from the ldap is encoded in a = right was to test it you can add a value manually in utf8 format f.e. h= =E9ll=F2 and read it with perl out... >Any help or pointers would be much appreciated. >Best regards, >-- >Wim Van Dijck >MIS - Internet Team - Eurocontrol >Support bacteria - they're the only culture some people have. greets Martin = |