BUG: RC2 and RC3 (maybe others) function SpellCheck() and cp1251

Started by ediww, August 23, 2006, 09:45:00 AM

Previous topic - Next topic

ediww

hi there,

i've found some nasty problems in function SpellCheck(), causing it to not work with my (bulgarian) language. The problem i've encountered is in 1.1RC2, but the problem stays in RC3 too.

I will not describe the pain in the ass i've had until i've figured out that not aspell/pspell is the problem.

I'll instead point the "solution" i've found, adding some code and pinning some values in:
All of the quotes are from Subs-Post.php
first,  just after


function SpellCheck()
{
        global $txt, $context, $func;


insert

        setlocale(LC_ALL, @$txt['lang_locale'] ); //edi

then, about 10-15 lines below, find

        // Next, the dictionary in question may not exist.  So, we try it... but...
      $pspell_link = pspell_new($txt['lang_dictionary'], $txt['lang_spelling'], '', strtr($txt['lang_character_set'], array('iso-' => 'iso', 'ISO-' => 'iso')), PSPELL_FAST | PSPELL_RUN_TOGETHER);

i've commented this out and placed this line instead
        $pspell_link = pspell_new('bg_BG', 'bulgarian', '', 'cp1251', PSPELL_FAST);
then, below, find a line like this:

      $alphas = 'љћабвгдезийклмнопстуфхцшщъыьэя[:alpha:]\'';


and replace it with

        $alphas = '[:alpha:]\''; //edi


and it works. actually, the last line changed causes the problem - 1) it does not work, 2) it does not contain some chars - like ж,ч,ю and maybe some others from cyrillics, and i am quite suspicious if it will work universally.

setlocale and [:alpha:] does the work, i dunno if the second (pspell link) change is nessesary, but i beg you consider using not $txt['lang_character_set'] but different, new language setting, for example, $txt['lang_spell_character_set'].

wwell edi
Beep-beep-beep. Beep-woop-woo. Beep-boop.

ivo2296

i did try but when i pess Spellchek all boxes are empty - i use smf RC3 and i have pspell library installed on red hat linux.


Thanks

btw i try bulgarian spellchek

ediww

ivo,
sorry did not read this in time - in 1.1 (1.1.1) there is surely a change in the spell check.

anyway, the first post's code was taken from a sucessfully worked with spellcheck forum, tested also on a "clean" install. if you do have problems - maybe you should check if the aspell/pspell is working correctly on your server.

edi
Beep-beep-beep. Beep-woop-woo. Beep-boop.

ivo2296


Advertisement: