@@ -619,6 +619,9 @@ static char *
619
619
CheckAffix (const char * word , size_t len , AFFIX * Affix , char flagflags , char * newword ) {
620
620
regmatch_t subs [2 ]; /* workaround for apache&linux */
621
621
int err ;
622
+ pg_wchar * data ;
623
+ size_t data_len ;
624
+ int dat_len ;
622
625
623
626
if ( flagflags & FF_COMPOUNDONLYAFX ) {
624
627
if ( (Affix -> flagflags & FF_COMPOUNDONLYAFX ) == 0 )
@@ -638,17 +641,29 @@ CheckAffix(const char *word, size_t len, AFFIX * Affix, char flagflags, char *ne
638
641
639
642
if (Affix -> compile )
640
643
{
641
- err = regcomp (& (Affix -> reg ), Affix -> mask , REG_EXTENDED | REG_ICASE | REG_NOSUB );
644
+ int wmasklen ,masklen = strlen (Affix -> mask );
645
+ pg_wchar * mask ;
646
+ mask = (pg_wchar * ) palloc ((masklen + 1 ) * sizeof (pg_wchar ));
647
+ wmasklen = pg_mb2wchar_with_len ( Affix -> mask , mask , masklen );
648
+
649
+ err = pg_regcomp (& (Affix -> reg ), mask , wmasklen , REG_EXTENDED | REG_ICASE | REG_NOSUB );
642
650
if (err )
643
651
{
644
652
/* regerror(err, &(Affix->reg), regerrstr, ERRSTRSIZE); */
645
- regfree (& (Affix -> reg ));
653
+ pg_regfree (& (Affix -> reg ));
646
654
return (NULL );
647
655
}
648
656
Affix -> compile = 0 ;
649
657
}
650
- if (!(err = regexec (& (Affix -> reg ), newword , 1 , subs , 0 )))
658
+
659
+ /* Convert data string to wide characters */
660
+ dat_len = strlen (newword );
661
+ data = (pg_wchar * ) palloc ((dat_len + 1 ) * sizeof (pg_wchar ));
662
+ data_len = pg_mb2wchar_with_len (newword , data , dat_len );
663
+
664
+ if (!(err = pg_regexec (& (Affix -> reg ), data ,dat_len ,NULL , 1 , subs , 0 )))
651
665
return newword ;
666
+
652
667
return NULL ;
653
668
}
654
669
@@ -995,7 +1010,7 @@ NIFree(IspellDict * Conf)
995
1010
for (i = 0 ; i < Conf -> naffixes ; i ++ )
996
1011
{
997
1012
if (Affix [i ].compile == 0 )
998
- regfree (& (Affix [i ].reg ));
1013
+ pg_regfree (& (Affix [i ].reg ));
999
1014
}
1000
1015
if (Conf -> Spell ) {
1001
1016
for (i = 0 ; i < Conf -> nspell ; i ++ )
0 commit comments