don't fall back to json dict for text that only contains latin-1

This commit is contained in:
wareya committed 2019-05-14 00:36:13 -04:00
1 parent 57cdb9e0ae
commit e7812ac589
1 file changed
+10
+10
View File
@@ -139,6 +139,15 @@ function json_lookup_arbitrary_as_is(dict, text)
return copy(dict.entries[index]); return copy(dict.entries[index]);
} }
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)
{ {
@@ -146,6 +155,7 @@ function json_dict_any_as_is(text)
if(ret !== undefined) if(ret !== undefined)
return ret; return ret;
} }
}
return undefined; return undefined;
} }