Posted on 2005-06-25 15:42:02-07 by maxscape
I have problems setting up utf-8 with apache, mysql, DBI and DBD
I am trying to use DBD::mysql with utf8. I think I have configured mysql and apache well, but still I can't get utf-8 encoded data fields from mysql. Has anybody an idea what to do?
Direct Responses: 1516 | Write a response
Posted on 2005-12-27 19:14:12-08 by amix in response to 654
Re: I have problems setting up utf-8 with apache, mysql, DBI and DBD
To get incoming data flagged, we have to cast Encode::decode_utf8 on each value we get from MySQL. It would be great if Patrick implements the simple feature that we can see in DBD::Pg -- pg_enable_utf8, which preserves the utf8 flag on the way from DB to the script. There's even a patch over the net which adds mysql_enable_utf8 support. Will it ever be added to the official packages?
Direct Responses: 1565 | Write a response
Posted on 2006-01-03 15:54:16-08 by fraktalisman in response to 1516
Re: I have problems setting up utf-8 with apache, mysql, DBI and DBD
Hi and thanks a lot for the information :) I have still a problem with Encode::decode_utf8. If the string to be decoded is already UTF-8, Encode::decode_utf8 returns an empty string! There seems to be no way to check if decoding is necessary, because in both cases (decoding successful or empty string), the string to be decoded was marked as "not utf" when I test it with Encode::is_utf8 . Is there a good way to avoid this problem? And what will happen, if a future version of DBI and DBD already handles the SQL data correctly? Will the decoding still work, or do we have to re-write all scripts then? I would be glad to get an answer here, maybe Patrick has something to say that solves my problems? Thanks in advance Ingo
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.