in reply to Re: Re: unicode file in mysql
in thread unicode file in mysql

Actually Text::Iconv is your friend.

#!/usr/bin/perl -w use strict; use Text::Iconv; use HTML::Entities; # create the conversion method (only once) my $conv = Text::Iconv->new("utf8", "latin1"); my $html_text = encode_entities( $conv->convert( $utf8_text));

If you want to get fancy you can use the bit of code in converting character encodings

Replies are listed 'Best First'.
Re: unicode file in mysql
by coeur2v (Initiate) on Aug 21, 2001 at 19:40 UTC
    Thank you for your help, but this module is not installed on my ISP'server.... :-(
    Do you know a method to do the same thing without using this module ?

      Warning: cargo-cult programming ahead! This code is from XML::TiePYX, it works except when the strings come from a recent version of XML::Parser.

      You can probably try this:

      sub utf2latin1 { my $text=shift; $text=~ s{([\xc0-\xc3])(.)}{ my $hi = ord($1); my $lo = ord($2); chr((($hi & 0x03) <<6) | ($lo & 0x3F)) }ge; return $text; }