I have this small script:
<?
header('Content-Type: text/javascript; charset=utf-8');
$s="L\u00e1szl\u00f3 M\u00e1rton";
echo $s;
?>
The browser displays “L\u00e1szl\u00f3 M\u00e1rton”
and it should display László Márton.
What I am doing wrong?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well you have to understand the difference between server, browser and javascript.
To answer your question “How to print unicode string in PHP” is simple: just print it:
But it seems you want to print Javascript-encoded sequence. OK. But you need to print well formed javascript then.