Re: utf8 output from database
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: utf8 output from database

From: Andy Hassall <andy@andyh.co.uk>
Date: Tue Nov 15 2005 - 23:25:04 CET

On Tue, 15 Nov 2005 12:05:32 -0000, "elyob" <newsprofile@gmail.com> wrote:

>I'm having problems outputting data from my MySQL database. The output
>should be Playa del inglés but instead I get ... Playa Del Ingl?s. I've
>tried utf8_encode(), but this just converts to Playa Del Inglă©s.
>
>Any advice? It seems to show fine in PHPMyadmin.

 What is the encoding of the page in PHPMyAdmin?

 (Right click, View Page Info in Firefox)

 How does the character appear in the page source in PHPMyAdmin? Is it encoded
as an HTML character entity (&eacute; or something like that), or output
directly?

 The key with solving character encoding issues is knowing exactly how
characters have been stored and encoded at every point in the system - from
initial input, stored in the database, any conversions on fetching from the
database, and on output to the final page. Once you lose track of the encoding
then you are in trouble.

-- 
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Received on Mon Nov 21 03:03:12 2005