Print

Print


Don't have experience but a search showed that you may have to set-up
your mysql connection from PHP to use utf8 as php isn't good with
unicode. They recommended this:

$result = mysql_query('SET NAMES utf8;');
$result = mysql_query('SET CHARACTER_SET utf8;');

You can apparently also set up your mysql to default all connections
to utf8. Here was where I found it:

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_21957635.html

Eby

On 4/10/07, Andrew Darby <[log in to unmask]> wrote:
> Hello, all.  I'm going a little crazy with getting some unicode data
> from MySQL to display properly in a web page, and wondered if you had
> any ideas.
>
> The records are in MySQL (4.1.21) with a utf8_unicode_ci collation.
> When I view in phpmyadmin, everything looks fine.  If I run my query
> in phpmyadmin, everything still looks fine, I can cut and paste the
> record into the web page, and it displays fine, but when I grab the
> data from MySQL it conks out:
>
> http://www.ithacalibrary.com/research/unicode_test.php
>
> I assume the problem is with my query or the connection, but I'm not
> sure how I should do it.  I've tried explicitly setting the character
> set like so:
>
> SET names = 'utf8_unicodel_ci';
> SET CHARACTER SET 'utf8_unicode_ci'
>
> But this is voodoo to me--just saw it somewhere on the internets.
>
> Am I missing something obvious?  Any ideas?
>
> Thanks,
>
> Andrew
>