Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #2090

Re: How do I force PHP to assume UTF-8 for $_GET?

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: How do I force PHP to assume UTF-8 for $_GET?
Date 2011-06-10 19:20 -0400
Organization A noiseless patient Spider
Message-ID <isu8sl$oei$1@dont-email.me> (permalink)
References <95f6abF3qjU1@mid.individual.net>

Show all headers | View raw


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@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How do I force PHP to assume UTF-8 for $_GET? Martin Kotulla <mk999@gmx.de> - 2011-06-10 20:32 +0200
  Re: How do I force PHP to assume UTF-8 for $_GET? Tim Streater <timstreater@waitrose.com> - 2011-06-10 19:54 +0100
    Re: How do I force PHP to assume UTF-8 for $_GET? Martin Kotulla <mk999@gmx.de> - 2011-06-10 21:00 +0200
      Re: How do I force PHP to assume UTF-8 for $_GET? Tim Streater <timstreater@waitrose.com> - 2011-06-10 21:56 +0100
        Re: How do I force PHP to assume UTF-8 for $_GET? Martin Kotulla <mk999@gmx.de> - 2011-06-10 23:59 +0200
          Re: How do I force PHP to assume UTF-8 for $_GET? Tim Streater <timstreater@waitrose.com> - 2011-06-10 23:28 +0100
            Re: How do I force PHP to assume UTF-8 for $_GET? legalize+jeeves@mail.xmission.com (Richard) - 2011-06-11 03:28 +0000
  Re: How do I force PHP to assume UTF-8 for $_GET? Jerry Stuckle <jstucklex@attglobal.net> - 2011-06-10 19:20 -0400
    Re: How do I force PHP to assume UTF-8 for $_GET? Martin Kotulla <mk999@gmx.de> - 2011-06-17 09:27 +0200

csiph-web