Quantcast
Channel: Active questions tagged utf-8 - Stack Overflow
Viewing all articles
Browse latest Browse all 1050

PHP json_encode json_decode UTF-8 [duplicate]

$
0
0

How can I save a json-encoded string with international characters to the databse and then parse the decoded string in the browser?

<?php               $string = "très agréable";      // to the database     $j_encoded = json_encode(utf8_encode($string));     // get from Database     $j_decoded = json_decode($j_encoded); ?>    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"><?= $j_decoded ?></html> 

Viewing all articles
Browse latest Browse all 1050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>