Creating a string array from encoded form input


#1

Hello,

I’m continuing my work on integrating FCKEditor into Rails, focusing
on getting the serverside spell checking to work. I’ve ran into a bit
of a snag, however, and after spending quite some time on this, I
don’t know how to go further. The javascript submits the following
sort of text to the server to spell check:

Lorem%20i%3Cb%3Epsum%20dolor%20sit%20a%3C%2Fb%3Emet%2C%20consectetuer %20adipiscing%20elit.%20Etiam%20vitae%0D%0Aeros.%20Proin%20lectus%20quam%2C %20malesuada%20vitae%2C%20ornare%20et%2C%20mattis%20ac%2C%20ligula. (Line breaks added in email for formatting purposes)

I’ve tried running regular expressions to remove all of the extra
stuff, but that quickly becomes an ugly mess because the html is sent
as well. Therefore, I would have the original text as well as the
html text to weed out. I was able to get around this, but then I
discovered that it would leave the “nbsp” from the html encoding for a
non breaking space. I can only assume that other html special
characters would be left behind as well.

Looking at the provided php source from FCKEditor, it looks as if php
can put this automatically into an array through some hidden magic of
some sort. I’m at my wits end in trying to find a solution to this
problem. Does anyone have any idea how I might be able to make an
array out of this?

The other option I have is even uglier in the page itself, but uses
the great ajax spellchecker ttutorial posted by Dee Z… I could
try to hide the fckeditor, copy the text only into a ttext box, and
then run the spell checker on that. I’m not sure if that would work,
though, becuase of the extensive modifications to the DOM that
FCKEditor creates. My preferred solutions is to figure out how to get
that text into an array I can feed into aspell for checking
purposes…

Any help will be greatly appreciatted. This work, once completed,
will be added to my FCKEditor integration How-to.

Thanks,
Josh