mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Fix the spellfix1_scriptcode() function to ignore whitespace and punctuation,
and to recognize hebrew and arabic scripts. FossilOrigin-Name: 7adfa4a5794e47f97491c08abeaaac90e826b331
This commit is contained in:
@ -1717,17 +1717,23 @@ static void scriptCodeSqlFunc(
|
||||
# define SCRIPT_LATIN 0x0001
|
||||
# define SCRIPT_CYRILLIC 0x0002
|
||||
# define SCRIPT_GREEK 0x0004
|
||||
# define SCRIPT_HEBREW 0x0008
|
||||
# define SCRIPT_ARABIC 0x0010
|
||||
|
||||
while( nIn>0 ){
|
||||
c = utf8Read(zIn, nIn, &sz);
|
||||
zIn += sz;
|
||||
nIn -= sz;
|
||||
if( c<0x02af ){
|
||||
if( c<0x02af && (c>=0x80 || midClass[c&0x7f]<CCLASS_DIGIT) ){
|
||||
scriptMask |= SCRIPT_LATIN;
|
||||
}else if( c>=0x0400 && c<=0x04ff ){
|
||||
scriptMask |= SCRIPT_CYRILLIC;
|
||||
}else if( c>=0x0386 && c<=0x03ce ){
|
||||
scriptMask |= SCRIPT_GREEK;
|
||||
}else if( c>=0x0590 && c<=0x05ff ){
|
||||
scriptMask |= SCRIPT_HEBREW;
|
||||
}else if( c>=0x0600 && c<=0x06ff ){
|
||||
scriptMask |= SCRIPT_ARABIC;
|
||||
}
|
||||
}
|
||||
switch( scriptMask ){
|
||||
@ -1735,6 +1741,8 @@ static void scriptCodeSqlFunc(
|
||||
case SCRIPT_LATIN: res = 215; break;
|
||||
case SCRIPT_CYRILLIC: res = 220; break;
|
||||
case SCRIPT_GREEK: res = 200; break;
|
||||
case SCRIPT_HEBREW: res = 125; break;
|
||||
case SCRIPT_ARABIC: res = 160; break;
|
||||
default: res = 998; break;
|
||||
}
|
||||
sqlite3_result_int(context, res);
|
||||
|
Reference in New Issue
Block a user