Hey comrades. I recently used jQuery auto-complete tag
http://devthought.com/projects/jquery/textboxlist/
everything is going fine, except for the proposed utf-8 tag, only English tags are offered
I think something is wrong with the lines of the script, it works fine with English tags, but not with a few byte languages like Persian
Probably line 212 in TextboxList.Autocomplete.js is to blame:
regexp = new RegExp('\\b' + escapeRegExp(search), insensitive ? 'i' : '');
. , JavaScript RegExp - - ASCII _. RegExp Unicode, , , ASCII.
_
\\b, , .
\\b
HTTP- . :
header('Content-Type: application/json; charset=UTF-8');
MySQL:
$sql = 'SELECT `tag` FROM `'.$prefix.'_tags` ORDER BY `tag`'; $result = $db->sql_query($sql); if (!$result) { header($_SERVER['SERVER_PROTOCOL'].' 500 Internal Server Error'); echo mysql_error(); exit; } $response = array(); $i = 0; while ($row = $db->sql_fetchrow($result)) { $response[] = array($i++, $row); } header('Content-Type: application/json; charset=UTF-8'); echo json_encode($response);
. -, content-type:something; charset=something, content-type:text/html; charset=utf-8.
content-type:something; charset=something
content-type:text/html; charset=utf-8
- application/json, . JSON?
application/json
, ,
header("Content-Type:application/json; charset=UTF-8");
Probably line 215 in TextboxList.Autocomplete.js is to blame:
if (regexp.test(values[i][1])) newvals.push(values[i]);
hides him up
if (values[i][1].indexOf(escapeRegExp(search)) != -1) newvals.push(values[i]);
Bobins (first answer) is correct, the problem is on line 212, but it can be resolved on line 215
Source: https://habr.com/ru/post/1729769/More articles:IPhone app crashes in adhoc mode - objective-cHow to check which program is running inside gnome-terminal - linuxPostgreSQL: clear all tables - sqlHow to improve cursor navigation performance in Visual Studio 2010? - visual-studioA watermark that is first deleted when a key is pressed? - jqueryCompilation of the problem. C # - c #Finding fast default aliases in Python - pythonHow to choose a migration path from Delphi 2007 - unicodeSet autoincrement attribute in XML node - pythonLinux Is there a way to have a simple static library containing resources? - linuxAll Articles