Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news.netcologne.de!newsfeed-fusi2.netcologne.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Martin Kotulla Newsgroups: comp.lang.php Subject: How do I force PHP to assume UTF-8 for $_GET? Date: Fri, 10 Jun 2011 20:32:34 +0200 Lines: 20 Message-ID: <95f6abF3qjU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net KbXilyCrbut0VYfumLC/hAT0AB4IcuMXRoObaQli5eJOpjV+0= Cancel-Lock: sha1:mf7LPTRv6L4lq2KJUt7wOGehXLg= User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 Xref: x330-a1.tempe.blueboxinc.net comp.lang.php:2082 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