469,913 Members | 1,947 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,913 developers. It's quick & easy.

utf8 output from database

Hi,

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.

Thanks
Nov 22 '05 #1
8 1966
elyob wrote:
Hi,

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.

Thanks


Hi, elyob,

Are you using an HTML charset that displays the "é"?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 22 '05 #2

"Jerry Stuckle" <js*******@attglobal.net> wrote in message
news:-s********************@comcast.com...
elyob wrote:
Hi,

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.

Thanks


Hi, elyob,

Are you using an HTML charset that displays the "é"?


I thought so ...
Nov 22 '05 #3

"elyob" <ne*********@gmail.com> wrote in message
news:43********@news1.homechoice.co.uk...

"Jerry Stuckle" <js*******@attglobal.net> wrote in message
news:-s********************@comcast.com...
elyob wrote:
Hi,

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.

Thanks


Hi, elyob,

Are you using an HTML charset that displays the "é"?


I thought so ...

<meta http-equiv="content-type" content="text/html;charset=utf-8" />
Nov 22 '05 #4
elyob wrote:
"elyob" <ne*********@gmail.com> wrote in message
news:43********@news1.homechoice.co.uk...
"Jerry Stuckle" <js*******@attglobal.net> wrote in message
news:-s********************@comcast.com...
elyob wrote:

Hi,

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.

Thanks

Hi, elyob,

Are you using an HTML charset that displays the "é"?


I thought so ...


<meta http-equiv="content-type" content="text/html;charset=utf-8" />


I'm going to show my ignorance of foreign languages here - is this
Italian, French or what? And what's the hex value of the character?

I have seen other problems like this; it's generally the charset isn't
set up to display that particular character. And I'm not sure UTF-8
will do it.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 22 '05 #5
elyob wrote:
"elyob" <ne*********@gmail.com> wrote in message
news:43********@news1.homechoice.co.uk...
"Jerry Stuckle" <js*******@attglobal.net> wrote in message
news:-s********************@comcast.com...
elyob wrote:

Hi,

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.

Thanks

Hi, elyob,

Are you using an HTML charset that displays the "é"?


I thought so ...


<meta http-equiv="content-type" content="text/html;charset=utf-8" />


One other thing - what happens if you use iso-8859-1?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Nov 22 '05 #6
In article <L8********************@comcast.com>,
Jerry Stuckle <js*******@attglobal.net> wrote:

[...]
I have seen other problems like this; it's generally the charset isn't
set up to display that particular character. And I'm not sure UTF-8
will do it.


The charset parameter doesn't 'do' anything. It simply claims which
character repertoire applies. If the content is utf-8, the charset
should say so. If the content is for example mac-roman, claiming
"charset=utf-8" doesn't *make* it utf-8. You'll need to transliterate to
utf-8 first.

Thus, you need to always, in this order,
- know what character repertoire your original content is in
- optionally transliterate to another character repertoire
- ensure all tools you use handle that character repertoire properly
- provide the correct charset value to let user-agents know how to
handle the data

--
Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>

Mac user: "Macs only have 40 viruses, tops!"
PC user: "SEE! Not even the virus writers support Macs!"
Nov 22 '05 #7
On Tue, 15 Nov 2005 14:59:17 -0000, "elyob" <ne*********@gmail.com> wrote:
<meta http-equiv="content-type" content="text/html;charset=utf-8" />


PHP is a server-side programming language, and so is capable of outputting
real HTTP headers. These are by far more preferable to meta Content-type
headers, which are more useful for storage media that don't have separate
metadata - i.e. when just dumped to a filesystem.

<?php header("Content-type: text/html;charset=utf-8"); ?.

... is much more likely to cause the browser to accept the encoding of the
page as UTF-8.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 22 '05 #8
On Tue, 15 Nov 2005 12:05:32 -0000, "elyob" <ne*********@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 :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 22 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by sinasalek | last post: by
6 posts views Thread by Spamtrap | last post: by
1 post views Thread by ryang | last post: by
4 posts views Thread by EmeraldShield | last post: by
4 posts views Thread by weheh | last post: by
reply views Thread by damonwischik | last post: by
1 post views Thread by Server Applications | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.