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

Home » Imported messages » comp.lang.php » How do I force PHP to assume UTF-8 for $_GET?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: How do I force PHP to assume UTF-8 for $_GET? [message #174424 is a reply to message #174416] Fri, 10 June 2011 23:20 Go to previous messageGo to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 6/10/2011 2:32 PM, Martin Kotulla wrote:
> Hello,
>
> I have a Windows application (which I cannot change) that calls my PHP
> script and passes it parameters via GET. The application sends properly
> encoded UTF-8 parameters, but does not indicate the UTF-8 character set
> in the HTTP headers (it does not indicate any character set at all).
>
> When I now access the parameters via $_GET in my PHP script, they are
> interpreted as ISO-8859-1 instead of UTF-8.
>
> For example, the Chinese character U+3563 is represented by the UTF-8
> bytes 0xE3, 0x95, 0xA3. PHP sees the two ISO-8859-1 character 0xE3 and
> 0xA3, and silently drops 0x95, presumably because it is outside of the
> range of valid characters in ISO-8859-1.
>
> So, how can I force PHP to regard the parameters as UTF-8-encoded?
>
> Any insights appreciated.
>
> -mk

Get whomever wrote the Windows application to fix it. If it is sending
UTF-8 characters, it must indicate so.

It may not even be PHP's fault - the characters may be filtered out by
the server. It's the old story - GIGO - and you have garbage going in.

--
==================
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
Previous Topic: ldap_modify
Next Topic: Displaying UTF-8-encoded strings from MySQL with PHP
Goto Forum:
  

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

Current Time: Fri Sep 20 13:24:42 GMT 2024

Total time taken to generate the page: 0.05237 seconds