Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
PHP: Problem with utf8_encode/decode
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Malcolm
n00b
n00b


Joined: 11 Jul 2002
Posts: 59
Location: Ontario, Canada

PostPosted: Mon Jan 08, 2007 8:30 pm    Post subject: PHP: Problem with utf8_encode/decode Reply with quote

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
Code:
Ü
Ü
Ü

On my test server I get
Code:
Ü
Ã?
Ü


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?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum