Blog Projects Publications Contact About

NSSpellServer tearing my hair out no more! (fixed in 10.5.7)

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.

Core of the hatred

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.

Meeting CheckSpell

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 realised 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.service NSSpellServer is registered with registerLanguage:byVendor: for “en“, “fr” .. etc. languages and “Apple” vendor.
CheckSpell.service NSSpellServer is registered for exclusively other languages as “pl“, “cs“, “lt“, “lv“, “sk” … with “Apple” vendor (“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 vice-versa AppleSpell.service for “pl“! This happens by instance in Mail.app, when I first use English spell checking via AppleSpell.service, 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.service which is spell server based on NSSpellServer Cocoa API.
Once it is installed you should see additional languages such as Polski or 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.

Expected results

1st line should be valid only in English (AppleSpell) spelling language set, 2nd should be valid only in Polish (CheckSpell).

Actual results

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).

Note that..

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 Foundation.framework contacts the NSSpellServer that is already running, it will always use THIS one regardless of selected language and other NSSpellServer that may be proper.

Additionally all NSTextView based GUIs such as Mail.app miss revalidation. Every time you change the language in Spelling & Gramma 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 countrymans 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.

Postscriptum

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 disable AppleSpell.service. This should make the trick, even it is quite bad idea to touch /System/Library/Services.

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.

13 Responses to “NSSpellServer tearing my hair out no more! (fixed in 10.5.7)”

  1. 1
    Huski

    First, big thanks for devoting your time and efforts to draw Apple’s attention to that problem. IMHO, I presume that nothing will change until Polish spell-checker will be implemented by Apple originally.

  2. 2
    tench

    I was very glad to read your post — I now know that I am not the only freak around who’s been upset about the way spell-checking works on the Mac. I’ve sent feedback too. It’s embarrassing for Apple. My other pet peeve is that there is no way to change languages directly in the mail.app window, but one always has to open the spelling pane. One should really have shortcuts for this.

    Now, I’ve gone to the web site of CheckSpell — it’s all in Polish. I can sort of understand it, because I speak Russian, but I am still a bit reluctant to install it. In cocoAspell, one can add new words to the spelling dictionary and they are kept in a file in one’s Library/Spelling. Now, over time, I’ve accumulated a significant number of these. Would I be able to add them to CheckSpell? And is CheckSpell really faster than cocoAspell? And how would one manually disable AppleSpell services? 

  3. 3
    Adam

    tench: Thanks for cheering me up. I believe you can encounter the language switch problem also with cocoAspell (at least I did), so it doesn’t matter if you install CheckSpell or not, Foundation will mess with your secondary spelling server anyway. Regarding new words and adding them back to CheckSpell I have no clue. Is CheckSpell faster than cocoAspell ?, I believe it is. It relays on OpenOffice spelling engine with is pretty fast in comparison to aspell.
    To disable AppleSpell you need to go to /System/Library/Services and move AppleSpell.service out into some safe place. Note that cocoAspell and CheckSpell reside in /Library/Services (/System/Library is reserved for Apple & system files).

  4. 4
    tench

    i know, i definitely experienced the switch problem with cocoAspell as well. i will test checkspell later — i’m very curious. i will keep my fingers crossed that apple gets its act together. (admittedly, in their attempt to simplify things for the user, they did introduce the multilingual mode for spell-checking, which works reasonably well… especially in single-language documents, BUT they forgot that that works only for the languages which they officially support… which leaves many of us in the dark…) 

  5. 5
    Steingrímur Árnason

    I am also a developer of a 3rd party spelling service for Mac OS X and have the same issue.
    Can you please publish the Radar (bugreporter.apple.com) ID number so I can ask Apple about it? 

  6. 6
    Sjur

    Hello Adam,

    I just saw your posting on the cocoadev mailing list. I can only confirm the bug that you describe. I’m heading a project developing Sámi proofing tools, and we have been looking at ways of delivering system-wide spell checking for Mac users.

    The basic problem is of course the bug you report, and adding all languages to CheckSpell is no solution. Some users prefer one set of languages, and others another set – it has to be possible for different spellServer servers to coexist.

    I see that CheckSpell is based on Hunspell, which is what we are using as well for our OpenOffice support. Do you know whether CheckSpell is open source? There is a rather new project on sourceforge trying to wrap Hunspell into a SpellServer API, called OpenXSpell. Even there Hunspell is used as the main (or rather first) speller engine being wrapped.

    Eventually, Hunspell is not ideal for many languages including the Sámi ones, and we hope to develop our own speller engine. This only to emphasize the need for allowing several spellServer servers to run concurrently, and the requirement that it should be possible to switch among languages and speller servers on the fly, reliably, and at any given time.

  7. 7
    Adam

    If you have ADC account please fill a bug report at bugreport.apple.com and reference Problem ID 6206237

  8. 8
    Jasonian.

    Since Apple never promises to fix any bug that exists, getting pissy with them probably doesn\’t do much good. Plus, you don\’t know why Apple hasn\’t released a fix. It might be something that was resolved a long time ago and just hasn\’t made it into a release, it may be that the problem isn\’t considered important enough to fix now, or it may be that fixing it is more difficult than you imagine. All that said, I hope if and when it\’s finally fixed, you make as big a deal thanking Apple as you do slapping them. 

  9. 9
    Adam

    Jasonian: Well my objective is not to slap Apple, rather just to get everybody know that the problem is a fault of Apple Mac OS X rather than Cocoaspell or CheckSpell software. Once many people that are annoyed get that, Apple may revise its mind and consider the bug important. Anyway doing anything is just IMHO better than nothing and getting pissed everyday with the annoying freaking bug! Yeah… I hate this bug, and is a small mf that stops me from loving OSX. (Ugh.. getting nervous maybe because of Clawfinger that’s on here ;P)

  10. 10
    Steingrímur Árnason

    FYI, this problem was addressed in the 10.5.7 update released today. :)

  11. 11
    Adam

    Steingrímur: They have finally fixed it. Hooray! I just received mail from Apple asking me to verify whether this bug has been fixed. So far it works as it should I can switch spelling in Safari and Mail w/o any problem or need to restart.

  12. 12
    10.5.7 naprawia błąd przełączania sprawdzania pisowni między Polskim (CheckSpell lub CocoAspell) i wbudowanymi Apple - Apple Blog

    [...] Więcej opisane po angielsku tutaj. [...]

  13. 13
    tench

    Hey Adam, congratulations on getting Apple to get its act together. I’m sure that if it hadn’t been for you — and your persistence — they woud’ve never fixed this. It’s a small step for Apple, and a huge step for humanity :)

Leave a Reply

*
To prove you're a person (not a spam script), type the answer to the math equation shown in the picture. Click on the picture to hear an audio file of the equation.
Click to hear an audio file of the anti-spam equation