Thanks for this, Darren.

It turns out that, although I had already explicitly set the character set and 
collation for the table I was updating/viewing, that wasn't enough.

I reset the MySQL server variables to use utf8 for the default character set, 
then dropped and recreated the database, explicitly setting the character set 
and collation. Then I reloaded the data. (Fortunately it wasn't a large 
database.)

That proved enough for the Mac OS X development environment. On a Solaris 
server, I had to go one step further: explicitly set the connection character 
set (using "SET NAMES 'utf8'") immediately after establishing the mysqli 
connection. Now all is well.

I'm a bit curious why the connection character set apparently defaulted to utf8 
on the Mac but not on Solaris. Perhaps the former is more utf8-friendly (or 
utf8-centric)?


On 10/12/09 6:37 PM, "Darren Cook" <dar...@dcook.org> wrote:

> The problem in the PHP app is that they don't sort in the correct order. For
> ex., capital E with any accent sorts between A and B.

That's a curious symptom. I've no suggestion, but the other information
you didn't give was:

 a) do you have the mbstring extension installed (and if so, what is the
internal_encoding, and the other settings)?

 b) do you have the intl extension installed (and, again, what settings)?

 c) what is the server's locale setting?

The first two you can get from a phpinfo() page. For the 3rd I think
$_ENV["LANG"] is it, or this should confirm it:
  print_r(setlocale(LC_ALL,"0"));

Also take a look at  http://jp.php.net/setlocale  and try setting
"en_US.UTF8" explicitly at the top of your script. The comments say Mac
requires "UTF-8", so you might also want to try:
   setlocale(LC_ALL,Array("en_US.UTF8","en_US.UTF-8"));

(untested)

Darren

P.S. On the MySQL side have a look at the collation setting of the database.



--
Darren Cook, Software Researcher/Developer
http://dcook.org/gobet/  (Shodan Go Bet - who will win?)
http://dcook.org/mlsn/ (Multilingual open source semantic network)
http://dcook.org/work/ (About me and my work)
http://dcook.org/blogs.html (My blogs and articles)

--
PHP Unicode & I18N Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
Michael R. Boudreau
Senior Publishing Technology Analyst
The University of Chicago Press
1427 E. 60th Street
Chicago, IL 60637
(773) 753-3298  fax: (773) 753-3383

Reply via email to