Path: csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Date: Fri, 04 Feb 2011 11:53:12 +0100 From: Luuk User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en_US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 Newsgroups: comp.lang.php Subject: Re: json and non UTF8 References: In-Reply-To: X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Message-ID: Lines: 34 NNTP-Posting-Host: 80.101.116.74 X-Trace: 1296816789 news.xs4all.nl 41113 [::ffff:80.101.116.74]:59154 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.php:11243 On 04-02-11 01:40, Jeff Thies wrote: > On 2/3/2011 10:07 AM, Luuk wrote: >> On 03-02-11 15:43, Jeff Thies wrote: >>> I've got some text that contains some odd characters that json_encode >>> is returning nulls on. I'd like to either fix the characters, get rid of >>> them or anything that doesn't give me a null. >>> >>> Jeff >> >> Can you give more detail on this 'odd characters'? >> Maybe show them here with bin2hex()? >> i.e. print bin2hex('abcdef'); >> 616263646566 > > I was trying to json_encode this and it choked on the bullet. > > Project Feasibility & Development > •Client and end user needs assessment >> >> And in the subject you state 'non UTF8' >> In the docs of 'json_encode' i read: >> "This function only works with UTF-8 encoded data" > > Yeah, that is what I noticed too. It took me a couple hours to figure > it out! You could try to convert this text from UTF-8 to another character-set print (json_encode(iconv('UTF-8', \"ISO-8859-15//IGNORE\", '•Client'))); this prints "Client"; -- Luuk