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 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> References: <95f6abF3qjU1@mid.individual.net> <95f7trFehmU1@mid.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: Xref: x330-a1.tempe.blueboxinc.net comp.lang.php:2087 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