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


Groups > comp.lang.php > #2087

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

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Martin Kotulla <mk999@gmx.de>
Newsgroups comp.lang.php
Subject Re: How do I force PHP to assume UTF-8 for $_GET?
Date Fri, 10 Jun 2011 23:59:09 +0200
Lines 23
Message-ID <95fidnFk6U1@mid.individual.net> (permalink)
References <95f6abF3qjU1@mid.individual.net> <timstreater-5EBE80.19545510062011@news.individual.net> <95f7trFehmU1@mid.individual.net> <timstreater-6699FF.21564610062011@news.individual.net>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net tZmcWMQfmL9o0xPxlUHvuQnvrNFqMGX5U+tuVmcSNeAICtIgY=
Cancel-Lock sha1:TejPPeXqtnzN/kI8nu0/5p8fezY=
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10
In-Reply-To <timstreater-6699FF.21564610062011@news.individual.net>
Xref x330-a1.tempe.blueboxinc.net comp.lang.php:2087

Show key headers only | View raw


On 10.06.2011 22:56, Tim Streater wrote:
>
> OK, maybe I was asking the wrong question. What do you mean by "access"
> in "When I now access the parameters via $_GET in my PHP script, ..."?
> Have you checked that when the Win-app sends U+3563 you get three bytes
> of data (0xE3, 0x95, 0xA3) in your PHP script? What are you then
> intending to do with those Chinese characters?
>

The Windows app sends three UTF-8 encoded characters. The PHP $_GET 
array only returns two, one being dropped by PHP because it considers 
out-of-range characters (in its ISO-8859-1 mind) incorrect.

My script needs to accept arbitrary UTF-8 sequences but PHP drops these 
characters because it (correctly, in its ISO-8859-1 mind) thinks they 
are invalid. But in the UTF-8 system, they are valid.

I need a way to tell PHP that the sequence is UTF-8 before I access it. 
As soon as my script reads something that PHP considers ISO-8859-1, the 
damage is done. iconv back to UTF-8 won't help me, I cannot unscramble 
scrambled eggs.

-mk

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