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

Home » Imported messages » comp.lang.php » Displaying UTF-8-encoded strings from MySQL with PHP
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Displaying UTF-8-encoded strings from MySQL with PHP [message #174511 is a reply to message #174509] Wed, 15 June 2011 10:53 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 6/15/2011 6:26 AM, "Álvaro G. Vicario" wrote:
> El 15/06/2011 12:18, Luke escribió/wrote:
>> I'm trying to migrate my project from ISO-8859-1 (Western Europe) to
>> UTF-8. I *can* write special characters as regular text in my php-
>> files, I can use special characters in echo-statements and I can even
>> use special characters in .ini-files, load them, and display them. But
>> when I load Strings with special characters from MySQL and display
>> them, the string's "broken".
>>
>> I've tried many things: First of all, I use
>>
>> <?xml version="1.0" encoding="utf-8" ?>
>> and
>> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
>>
>> in the markup. In the database I tried to set my table's collation to
>> "utf8_general_ci". Also I tried the following functions:
>>
>> mysql_query("SET NAMES ‘utf8′");
>> mysql_set_charset('utf8');
>> mb_internal_encoding("UTF-8");
>>
>> all not at the very beginning of my script, but before I queried the
>> database and before I printed the results. I still keep getting
>> 'wierd' characters.
>>
>> Does anyone have an idea what I can do?
>
> Here's quite a complete list of the required steps:
>
> http://www.itnewb.com/v/UTF-8-Enabled-Apache-MySQL-PHP-Markup-and-JavaScrip t
>
>
> Whatever, are you sure that your data is actually stored as valid UTF-8
> after the migration?
>
> The HEX() function can be handy:
>
> http://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_hex
>
>
>

Álvaro, I admit I'm not great at UTF-8. This is a great guide if you
have your own server and want everything in UTF-8. However, do you know
of a similar reference for those who use shared servers and/or don't
want everything to default to UTF-8?

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How do I force PHP to assume UTF-8 for $_GET?
Next Topic: radio button change after going to next page
Goto Forum:
  

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

Current Time: Tue Nov 26 04:36:12 GMT 2024

Total time taken to generate the page: 0.04849 seconds