My team uses the FCKEditor for some rich text editing on one of our products. A new requirement requested of us by product development, is that the editor have spell check enabled. So, I started digging. It sounds like the Aspell spell checker is the one to go with. Enabled like this:
FCKConfig.SpellChecker = 'SpellerPages';
Our servers are Windows servers, but we do our development on our local machines. Half of our developers use Macs and the other half are on Windows. This is where the problem comes in. I need to get it to work in both environments.
So, I am attempting to get the spell checking working on my MacBook Pro. I downloaded and installed aspell and successfully tested it with this command in Terminal:
echo "this word is mispeled" | /opt/local/bin/aspell -a -d american -H
So, that works. That returns a list of potentials for the misspelled word(s).
But, I needed to modify the spellchecker.cfm file because the stock cfexecute is set up for a Windows environment. Here is the original call:
<cfexecute name="cmd.exe" arguments='/c type "#tempfile_in#" | "#aspell_dir#\aspell.exe" #aspell_opts# > "#tempfile_out#"' timeout="100"/>
Here is the call that I modified it to:
<cfexecute name="/opt/local/bin/aspell" arguments='-c -type "#tempfile_in#" | -a --lang=en_US --encoding=utf-8 -H > "#tempfile_out#"' timeout="100" />
The problem is, is the system hangs for quite some time and I have not gotten it to return in a timely fashion, or at all. The second file is created with the suggestions, but the server hangs. What am I missing in my arguments? Or is there a better way to call it?
I am not an expert at Aspell, as I just downloaded it yesterday. I have been digging through the documentation but have not come up with a solution. Any help would be appreciated!
***UPDATE***
I am making some progress on this this morning. Here is the code that I have called from Terminal on my Mac...and it works there!
cat "/pathToFile/textToCheck.txt" | aspell -a --lang=en_US --encoding=utf-8 -H --rem-sgml-check=alt > "/pathToFile/dude.txt"
I still cannot get that to work with cfexecute. Anyone have any ideas? It would be just like in the DOS command "/c" which I thought was "script" on Unix, but I still can't get it to work.
***UPDATE AND FIX***
I found the fix! After 8+ hours of working through this, I finally got it to work! The "command" is different between Terminal on a Mac and cfexecut. In the cfexecute call, you need to use "bash" and tell it with the -c and quotes that you are running in command line mode. Here they both are. I hope this helps Mac and Unix users!
In Terminal:
cat "/pathToFile/textToCheck.txt" | aspell -a --lang=en_US --encoding=utf-8 -H --rem-sgml-check=alt > "/pathToFile/dude.txt"
From cfexecute:
<cfexecute name="/bin/bash" arguments='-c "cat #tempfile_in# | #aspell_dir# -a --lang=en_US --encoding=utf-8 -H > #tempfile_out#"' timeout="100" />
Here are some links that helped me get it to work!
http://www.yolinux.com/TUTORIALS/unix_for_dos_users.html
http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=00000243.htm