Re: Encoding problem
| From: | Guus Ellenkamp | Date: | Tue, 06 Feb 2007 01:42:29 +0000 |
| Subject: | Re: Encoding problem | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-248406@lists.php.net to get a copy of this message | ||
Found it. Have to use:
mysql_query("SET CHARACTER SET 'utf8'", $link);
""Guus Ellenkamp"" <Ellenkamp_Guus@hotmail.com> wrote in message
news:BF.ED.43531.142D7C54@pb1.pair.com...
> The document IS UTF-8. The character does not seem to be. It comes from a
> mySQL database. However, also the database settings are also UTF-8. The
> field was entered into the database with phpMyAdmin. I tried it now local
> on my test-system and remote, so the database itself does not seem to be
> the problem. Could it be phpMyAdmin?
>
> "Jon Anderson" <jon@gamingsolutions.ca> wrote in message
> news:45C73572.4030600@gamingsolutions.ca...
>> Guus Ellenkamp wrote:
>>> I have a string with an n with a tilde. mb_detect_encoding says it's
>>> UTF-8. I set the http encoding to UTF-8 and also the internal encoding.
>>> However, I cannot produce proper output with echo $varwithtilde.
>>>
>>> echo $returnArray[$i]->address1.' has
>>> '.mb_detect_encoding($returnArray[$i]->address1)
>>> does NOT produce correct output in a browser or with the W3C validator,
>>> although it says the encoding of the var is UTF-8.
>>>
>>> What's wrong?
>>>
>> Character set issues can be very complex, but I'm going to take a
>> guess....
>>
>> If you're outputting something that is actually UTF-8, you'll need to
>> make sure that you've done these:
>>
>> header('Content-Type: text/html; charset=utf-8');
>>
>> I believe that IE6 requires this one as well within your html head.
>>
>> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"
>> />
>>
>> If that doesn't work, then it could be that your character isn't actually
>> UTF-8 encoded.
>>
>> jon