NSSpellServer tearing my hair out no more! (fixed in 10.5.7)13 Oct 2008
I just received confirmation mail from Apple‘s technician regarding this bug and 10.5.7. Thank you! It took them a while to nail it down, but finally we can change spell checker language w/o restarting Mail or Safari.
A story with happy ending
Since a while I am a happy Mac OS X user, would be happiest one, if only I could write my mails easily.
Even I find myself often talk too much I am neither a perfect speaker nor writer. So something commonly called “spell checker” is an invaluable tool in my daily work, especially when sending bunch mails per day. Short after my transition to Mac I was very excited finding out that spell checking is built into the system. Unfortunately as a spelling mistake prone Pole speaking usually English at work and Polish privately I realized that having no Polish spell checker makes my doom.
cocoAspell goes first
In late 2007 browsing trough various forums I discovered cocoAspell, an extra spell checker service for OSX using aspell dictionaries. It was working pretty well, if only it was not crashing. cocoaSpell was not also fastest software I ever seen. Additionally I noticed everything I tried I was unable to perform successful switch to other language while already working in Mail.app, so it had to be restarted after every switch. That was terrible annoyance.
Anyway I was blaming cocoAspell, for not being updated for a long while.
In early 2008 the very first version of CheckSpell was released, with all its glory going to Marcin Dalecki (the author) for addressing all the drawbacks of cocaSpell such as performance, stability and flexibility and all the joy to ex-cocoaSpell users. After the first release I was working a bit with Marcin to fix some minor glitches of CheckSpell. Hitting 1.3 we have realized that Mail.app (and other apps) language switching problem is something that lays in the system framework and we cannot do anything about without Apple‘s help. Soon the others confirmed the problem.
Being a patient reporter
I rushed to Apple’s Mac OS X feedback page, filling the report. Bang, .. “thank you for your report”. Great! What now? Argh, what I should expect. I was looking on 10.5.2, 10.5.3, 10.5.4 passing by. And the bug was still there.
Being not discouraged, I kept trying to nail down the problem. It led me to
Foundation.framework of Mac OS X stubbornly calling wrong spell server.
Let me introduce you the bug
AppleSpell.serviceNSSpellServer is registered with registerLanguage:byVendor: for “en“, “fr” … etc. languages and “Apple” vendor.
CheckSpell.serviceNSSpellServer is registered for exclusively other languages as
“pl“, “cs“, “lt“, “lv“, “sk”… with
“Apple”is used here to avoid having vendor name in the list, however I checked for the bug using different vendor name “Check“, and it occurs as well).
So it often happens that Foundation calls
CheckSpell.service for “en” and
AppleSpell.service for “pl“! This happens by instance in
Mail.app, when I first use English spell checking via
and switch to Polish (pl) via
CheckSpell.service for my next mail, Foundation
(NSSpellChecker) is getting crazy, and asking AppleSpell for “pl“, which
results in totally wrong (empty) response. In order to get proper “pl” via
CheckSpell.service I need to restart Mail.app, but then when I want to
switch to English, once again I need to restart.
This problem hits all users using some extra spell checkers also CocoaSpell, so all eastern Europe, and all people using multiple languages at Mail.app.
But most important thing is that this problem is not related explicitly to Mail.app, which is just a reference. All applications using Foundation‘s spelling interface, such as Safari are affected. So yes, you need to restart your Safari closing all open windows and tabs if you want to switch spelling language when you type your blog or forum post.
How to reproduce it
Download and install CheckSpell.
The installer will create
/Library/Services/CheckSpell.servicewhich is spell server based on NSSpellServer Cocoa API. Once it is installed you should see additional languages such as
Cestina. Let’s try reproduce the bug with Polish<->English switching.
Try to open Mail.app and write new mail as below:
Here below is some Polish sentence. Tutaj u góry jest tekst po angielsku.
1st line should be valid only in English (AppleSpell) spelling language set, 2nd should be valid only in Polish (CheckSpell).
Unfortunately when I start writing mail with English spelling, switching to Polish doesn’t really make 2nd line valid, I get absolutely no response from Polish spell checker (probably AppleSpell is getting called with “pl” instead of CheckSpell)
Once the mail is saved and Mail.app restarted, it starts fine with Polish, until the switch back to English. Then CheckSpell is complaining that it is getting called with “en” language which it wasn’t registered for (AppleSpell should be called).
When you do:
killall AppleSpell CheckSpell prior running Mail.app,
switching spelling languages works somehow fine! So the problem appears when
AppleSpell & CheckSpell service processes are already running in the system.
So the problem may not appear 1st time when you run Mail.app after
installation of CheckSpell, please rerun it once both spelling service
processes are running.
So the diagnosis is that once single application using
contacts the NSSpellServer that is already running, it will always use THIS one
regardless of selected language and other
NSSpellServer that may be proper.
NSTextView based GUIs such as Mail.app miss revalidation.
Every time you change the language in Spelling & Grammar window and you got
Check spelling as you type ON the spelling is not revalidated with current
language, you need to click Next many many times, or scroll your cursor trough
whole document in order to make the spelling underline incorrect words in
current language. This is also the case when you open the saved mail in
Mail.app, incorrect words are not underlined on open.
Catching up bit closer with Apple
I have subscribed to cocoa-dev mailing list and sent there the report. What was my (positive) surprise when I received a response from Apple‘s employee asking for some extra details and claiming they will have a look at this. Woah, I thought, you rock dudes!
After I send the guy few extra lines about my configuration etc. I started looking towards the response and hopefully the FIX itself. None of them arrived. I have resent some mails asking for the contact, no reply. I have asked for feedback again on cocoa-dev, no reply. Even I saw the guy posting in other threads on the list.
Finally I filled bug 6206237 at bugreport.apple.com as some list member (but not an Apple’s employee) advised me.
Trying to believe I did something wrong
Apple, you should respond “Bugger off!” at the very beginning – to all the bug reports I have sent, to all OSX users that use custom spell checker. It is 10.5.5 right now and we still need to live with this bug.
All this makes me understand that the Apple’s way is to stay quiet as the grave, if there is any problem regarding their products. But there is no conclusion there, all I can say I feel the pity that all my reports gone into the drain and OSX cannot be pushed closer to the perfection (even it could), making myself and many my fellow countrymen happier.
I encourage everybody to post comments below about their experiences with this problem. Hope someday this will hit the eye of Apple’s management.
After having a sleep with the problem in my head, I tend to believe only way is
to add English, French, etc. spelling checking into CheckSpell and manually
AppleSpell.service. This should make the trick, even it is quite bad
idea to touch
~~You can help~~
~~If you have ADC account please fill a bug report at
bugreport.apple.com and reference
Problem ID 6206237.
Unfortunately Apple does not let you see other problems than just yours.~~
Posted in Mac