FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP, MySQL and UTF-8?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: PHP, MySQL and UTF-8? [message #175381 is a reply to message #175372] Tue, 13 September 2011 14:53 Go to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma:
Senior Member
Robert Latest wrote:

> I have UTF-8 characters in my database. They're there, I can see them in
> a MySQL dump as well as in phpmyadmin.
>
> When I retrieve this data from the db and output it via print(), all I get
> is question marks. These come from the server because I see them also in
> wget's output.

As for the wget output, your console might not be UTF-8-compliant, or you
might not have declared the proper character encoding for the HTTP resource
and the resource type (e. g., HTML) requires you to escape them then, which
you also failed to do.

> In phpmyadmin I see the correct characters in my db. When I insert them
> literally in my HTML they come out as expected. When I print() them as
> string literals in php, they come out correctly as well.

This and

> I think I'm opening the db correctly:
>
> $c = new PDO("mysql:host=$host;dbname=$dbname;port=$port;charset=UTF-8",
> $user, $pass);

suggests that the Content-Type header field of the HTTP response for your
Web site has the wrong value. And I think that is a FAQ.


PointedEars
--
Danny Goodman's books are out of date and teach practices that are
positively harmful for cross-browser scripting.
-- Richard Cornford, cljs, <cife6q$253$1$8300dec7(at)news(dot)demon(dot)co(dot)uk> (2004)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Startup City 2011 (September 24th,Mumbai)
Next Topic: Social Bookmarks Script
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 08:50:01 GMT 2024

Total time taken to generate the page: 0.03519 seconds