[TYPO3-rte] Spellchecker personal dictionaries

Andrea Schmuttermair abo at schmutt.de
Mon Jan 9 17:29:35 CET 2012


Hi Stanislas,

I found the problem and have a fix now, but it is quite ugly, so maybe 
you have a better solution.

As I have a german installation, there are lots of Umlaute(ä,ö,ü). So it 
was not a problem with writing to personal dictionary, but with 
encoding. Words without Umlaut could be added without problems.

You can see it, if you use Firebug and look at the Post Answer after 
adding to personal dictionary. It tells you the aspell error message:

&Sprachentwicklungsstörungen
#
cat '/www0713/www.audiva.de/typo3temp/rtehtmlarea_a6XmWA' | 
/www0713/local/bin/aspell -a --mode=none 
--home-dir='/home/www0713/www.audiva.de/uploads/tx_rtehtmlarea/BE_1' 
--lang='de' --encoding='utf-8' 2>&1
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.6.1)
Error: The word "sprachentwicklungsst?rungen" is invalid. The character 
'?' (U+3F) may not appear in the middle of a word.
Personal word list was updated.

Now I checked my encodings - but everything was UTF-8.
But: the personal dictionary file created by aspell is ANSI. If I 
convert it to UTF-8, aspell can't read it any more.

So this is how it works now:
I ignore all encoding settings and hardcode it to "ISO-8859-1".
Then I convert the input with utf8_decode. And I tell Aspell 
--encoding=ISO-8859-1


header('Content-Type: text/plain; charset=ISO-8859-1');
(...)
foreach ($to_p_dict as $personal_word) {
	$cmd = '&' .utf8_decode($personal_word). LF;
	echo $cmd;
	fwrite($filehandle, $cmd, strlen($cmd));
}
foreach ($to_r_list as $replace_pair) {
	$cmd = '$$ra ' . utf8_decode($replace_pair[0]) . ' , ' . 
utf8_decode($replace_pair[1]) . LF;
	echo $cmd;
	fwrite($filehandle, $cmd, strlen($cmd));
}
(...)
$AspellCommand = 'cat ' . escapeshellarg($tmpFileName) . ' | ' . 
$this->AspellDirectory . ' -a --mode=none' . $this->personalDictsArg . ' 
--lang=' . escapeshellarg($this->dictionary) . ' --encoding=ISO-8859-1 
2>&1';


So this is quite ugly, but at least it works for now.
Maybe it is just a problem with this special installation, as it quite 
old and just updated to 4.5 - some parts are still in latin-1 in the 
database.
But I don't think this is the reason, because aspell gets a UTF-8 file 
as input and has no connection to the database.
It would be great if someone can try to reproduce that bug on another 
system with aspell installation - to check if it is just me or if it is 
a general problem.

Regards,
Andrea


Am 30.12.2011 23:21, schrieb Stanislas Rolland:
> Hi Andrea,
>
> I don't have any time to look into this until mid-January.
>
> The write to dictionary is in
> typo3/sysext/rtehtmlarea/pi1/class.tx_rtehtmlarea_pi1.php
>
> Regards,
> Stanislas
>
>
>
> Le 2011-12-29 10:15, Andrea Schmuttermair a écrit :
>> No ideas?
>>
>> Can you tell me in which file (function) the "write to dictionary" code
>> is - so I can debug it?
>>
>> Thanks for any advice!
>>
>> Andrea
>>
>>
>> Am 18.12.2011 22:13, schrieb Andrea Schmuttermair:
>>> Hi,
>>>
>>> I have enabled the Spellchecker personal dictionaries, but it is not
>>> possible to add words to that.
>>>
>>> If I look in uploads/tx_rtehtmlarea/BE_1 there are two files:
>>> .aspell.de.prepl
>>> "personal_repl-1.1 de 0 " is content
>>> .aspell.de.pws
>>> "personal_ws-1.1 de 0 " is content
>>>
>>> If I add a new word, the file timestamp changes, but the word is not in
>>> any of these files.
>>>
>>> I have:
>>> TYPO3 Ver. 4.5.6
>>> rtehtmlarea Ver. 2.1.7
>>> aspell current version
>>>
>>> Thanks,
>>> Andrea
>>>
>>
>
>



More information about the TYPO3-project-rte mailing list