Skip to content
Snippets Groups Projects
Commit 4b9792c6 authored by Tom N Harris's avatar Tom N Harris
Browse files

Measure length of multi-character Asian words

parent ee0891d8
No related branches found
No related tags found
No related merge requests found
......@@ -52,8 +52,10 @@ function wordlen($w){
$l = strlen($w);
// If left alone, all chinese "words" will get put into w3.idx
// So the "length" of a "word" is faked
if(preg_match('/'.IDX_ASIAN2.'/u',$w))
$l += ord($w) - 0xE1; // Lead bytes from 0xE2-0xEF
if(preg_match_all('/[\xE2-\xEF]/',$w,$leadbytes)) {
foreach($leadbytes[0] as $b)
$l += ord($b) - 0xE1;
}
return $l;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment