Re: Re: json_encode() behavior and the browser

From: Date: Wed, 01 Sep 2010 14:25:39 +0000
Subject: Re: Re: json_encode() behavior and the browser
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.general 
Request: Send a blank email to php-general+get-307816@lists.php.net to get a copy of this message
In this case, you are right. It has nothing to do with the browser. You´ll need a more detailed debug so you can see excatly what´s happening. -- João Cândido de Souza Neto "Christoph Boget" <cboget@hotmail.com> escreveu na mensagem news:AANLkTikcTht0nXz1hi0EzJ=i2M3716Wepd=DepPKedgo@mail.gmail.com... >> Sorry about the error: >> In this case, you must set IT via meta tag to avoid it. > > Ok, let's try this using a different approach. Consider the following > pseudo-code: > > <?php > $result = mysql_query( 'SELECT name, date FROM table WHERE field = > "value"' ); > $array = array(); > while( $row = mysql_fetch_assoc( $result )) > { > $array[] = $row; > } > > $string = json_encode( $array ); > ?> > > Why does the charset of the browser matter one whit to the value of > either $row['name'] or $row['date'] such that it would break > json_encode() in one case and not the other. Is it that PHP is taking > the string which is returned as part of the result set and encoding it > to match the charset passed in from the browser? > > thnx, > Christoph > > * Disclaimer : the actual code (and data repository) I am using is > slightly different from the above but is similar enough so that it's a > valid representation

« previous php.general (#307816) next »