don't fall back to json dict for text that only contains latin-1
This commit is contained in:
1 parent
57cdb9e0ae
commit
e7812ac589
1 file changed
+10
@@ -140,12 +140,22 @@ function json_lookup_arbitrary_as_is(dict, text)
|
|||||||
}
|
}
|
||||||
function json_dict_any_as_is(text)
|
function json_dict_any_as_is(text)
|
||||||
{
|
{
|
||||||
|
let maybe_found_non_latin = false;
|
||||||
|
for(let i = 0; i < text.length; i++)
|
||||||
|
{
|
||||||
|
let codepoint = text.codePointAt(i);
|
||||||
|
if(codepoint > 0x100)
|
||||||
|
maybe_found_non_latin = true;
|
||||||
|
}
|
||||||
|
if(maybe_found_non_latin)
|
||||||
|
{
|
||||||
for(let dict of json_dicts)
|
for(let dict of json_dicts)
|
||||||
{
|
{
|
||||||
let ret = json_lookup_arbitrary_as_is(dict, text);
|
let ret = json_lookup_arbitrary_as_is(dict, text);
|
||||||
if(ret !== undefined)
|
if(ret !== undefined)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user