I'm having trouble passing utf-8 strings to javascript (ajax). I am currently using rawurlencodethe PHP side and unescapethe javascript side.
rawurlencode
unescape
The problem is in the Latin language and rawurlencodedoes not fully support it.
Is there an alternative or better option?
The solution was in the json_encodefunctions. Problems stopped when I added JSON_HEX_APOS|JSON_HEX_QUOT.
json_encode
JSON_HEX_APOS|JSON_HEX_QUOT
Thank!
use json_encode in PHP and get answers as JSON (jQuery is useful) ajax is sent to utf-8 by default, so you just need to return utf-8
php utf8_encode (data) ISO-8859-1 .
? , ;)
Javascript escape() (ant unescape()) Unicode (UTF-8). encodeURIComponent() decodeURIComponent().
, :
escape() URI.
php js-, php js? , , .
Source: https://habr.com/ru/post/1732911/More articles:Used FileStream - c #https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1732907/get-divs-to-behave-like-a-table&usg=ALkJrhgVs7O3HecgfzlzpLvlxo43Qz3cogDistributing sharepoint default.master? - sharepointWhy does the Moose role application with method modifiers not work in my code? - perlFor general cases, when one of them will work, which is better to use, a hash map or a hash table? - javaHow to display dependency conflicts in 'mvn site' - maven-2The default column value based on the value of another column - sqlC ++ - What libraries or command line programs will I need to create a program that takes an AVI file and burns it to a DVD? - c ++How can I make a rich web application in Perl? - user-interfaceThe class name for the unix-like permission object is javaAll Articles