Help for this page

Select Code to Download


  1. or download this
    
                    Manual, or with              Automatic with 
    ...
    ¦ Console ¦ <<-encode_utf8()--- ¦ strings ¦ <<-decode_utf8()--- ¦ MySQ
    +L DB ¦
     ---------                       ---------                       -----
    +-----
    
  2. or download this
    
        CREATE TABLE test_db.test ( string VARCHAR(50) ) CHARACTER SET utf
    +8;
    
  3. or download this
    
        use Encode qw( decode_utf8 );
        my $string      = <>;
        my $utf8_string = decode_utf8($string);
    
  4. or download this
    
       use Encode qw( decode );
       my $iso_8859_string = <>;
       my $utf8_string     = decode('ISO-8859-1',$iso_8859_string);
    
  5. or download this
    
        use utf8;         # Tells Perl that the script itself is written i
    +n UTF-8
    
        my $utf8_string = "UTF-8 string with special chars: ñ æ ô";
    
  6. or download this
    
        use DBI();
    ...
                                {mysql_enable_utf8 => 1}
        );
    
  7. or download this
    
        $dbh->do('INSERT INTO test_db.test VALUES(?)', $utf8_string);
    ...
        $dbh->do('SELECT string FROM test_db.test LIMIT 1');
        my $new_string = $dbh->fetchrow_arrayref->[0];
    
  8. or download this
    
        use Encode qw( encode_utf8 );
    ...
        binmode (STDIN,':utf8');
        print $new_string;
    
  9. or download this
    
        use Encode qw( encode );
        print Encode::encode('ISO-8859-1', $new_string);