Thread Perl speichert nicht als UTF-8 in MySQL DB
(5 answers)
Opened by roooot at 2009-05-17 21:12
Ich prüfe vor dem Schreiben in die DB den String so:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 if(!utf8::is_utf8($fieldvalue)) { croak qq{ Adressbook::User::Data->set_data() does not get a utf8 flagged fieldvalue. Died. } } Dein Code (perl): (dl
)
{ mysql_enable_utf8 => 1 } Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 my $mysql_config = $new_object->load_config(); use DBI; $database_handle_of{ident $new_object} = DBI->connect( "DBI:mysql:database=$mysql_config->{'table'}; host=$mysql_config->{'host'}; port=$mysql_config->{'port'};", $mysql_config->{'user'}, $mysql_config->{'password'}, { mysql_enable_utf8 => 1 } ) or croak $DBI::errstr; my $drh = DBI->install_driver("mysql"); Code: (dl
)
Täststring wird zu Täststring Ich benutze mein MySQL Modul schon Ewigkeiten und das fällt mir gerade zum ersten Mal auf, dass das so ist (war auch vorher nicht so). Viele Grüße :)
|