1

Topic: To translate from utf-8 in the javascript-text

Good afternoon!
How to translate a line
$s = "Greetings from  and !";
Written in UTF-8 in such type:
\u041F\u0440\u0438\u0432\u0435\u0442 \u043E\u0442 \u0424\u042B\u0412\u042B \u0438 \u041E\u041B\u0414\u0416\u0410!
?
Thanks!

2

Re: To translate from utf-8 in the javascript-text

encodeURIComponent ()

3

Re: To translate from utf-8 in the javascript-text

Hurried with the answer.
Question, what for to you to translate in such type?
HTML

header (' Content-Type: text/html; charset=utf-8 ');
$s = ' Greetings from  and ! ';
exit ($s);

JSON

header (' Content-Type: application/json ');
$s = array (' res ' => ' Greetings from  and ! ');
exit (json_encode ($s));