Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!news.musoftware.de!wum.musoftware.de!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 21:00:01 +0200 Lines: 15 Message-ID: <95f7trFehmU1@mid.individual.net> References: <95f6abF3qjU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net GI2D440Md9ktMdYOag4ksw+4BrQHpnYwbUfuVndOQW9hehcL8= Cancel-Lock: sha1:5bs1xphIYJ40JArFcrjFOW8odrc= 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:2084 On 10.06.2011 20:54, Tim Streater wrote: > > How do you know it's dropped anything? IIRC PHP knows nothing about > character sets, just bytes. Have you tried something like the following: > > $mystr = $_GET["mystr"]; > $utfstr = iconv ("iso-8859-1", "UTF-8//IGNORE", $mystr); > I tried that before. But in the example that I gave, the three UTF-8 bytes came out as two ISO-8859-1 characters. The 0x95 was dropped, presumably because it's in the range 0x80 to 0x9F which is not defined in ISO-8859-1. -mk