Malcolm n00b
Joined: 11 Jul 2002 Posts: 59 Location: Ontario, Canada
|
Posted: Mon Jan 08, 2007 8:30 pm Post subject: PHP: Problem with utf8_encode/decode |
|
|
I have an application that stores information into the database after using utf8_encode.
My live server is able to grab and manipulate the data but for some reason my Gentoo box, which I use for testing/development at home, is having some trouble with the encoding.
After the queries this is how I'm outputting the data: Code: | <?php
header('Content-Type: text/html; charset=iso-8859-1');
..{mySQL connection and query}...
echo $res['name']."<br />\n";
echo utf8_decode($res['name'])."<br />\n";
echo utf8_encode($res['name'])."<br />\n";
?> |
On my live server I get
On my test server I get
The actual encoded letter is "Ü" and it is stored in the database as "Ã"
I'm grabbing all data from the live server and these are my php USE flags: Code: | [ebuild R ] dev-lang/php-5.1.6-r6 USE="berkdb bzip2 cgi cli crypt ctype curl curlwrappers exif ftp gd gdbm iconv inifile ipv6 mysql mysqli ncurses nls pcre readline reflection session soap spell spl ssl tokenizer truetype unicode xml zip zlib -adabas -apache -apache2 -bcmath -birdstep -calendar -cdb -cjk -concurrentmodphp -db2 -dbase -dbmaker -debug -discard-path -doc -empress -empress-bcs -esoob -fastbuild -fdftk -filepro -firebird -flatfile -force-cgi-redirect -frontbase -gd-external -gmp -hardenedphp -hash -hyperwave-api -imap -informix -interbase -iodbc -java-external -kerberos -ldap -libedit -mcve -memlimit -mhash -ming -msql -mssql -oci8 -oci8-instant-client -odbc -pcntl -pdo -pdo-external -pic -posix -postgres -qdbm -recode -sapdb -sasl -sharedext -sharedmem -simplexml -snmp -sockets -solid -sqlite -sybase -sybase-ct -sysvipc -threads -tidy -vm-goto -vm-switch -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xsl -yaz" |
I'm also using lighttpd for my server, but the CLI output of the script looks pretty much the same Code: | ÃÅ<br />
Ã?<br />
ÃÂÃ
Â<br /> |
Any ideas as to why my compiled version of php isn't able to handle the characters? |
|