[TxMt] Spell checking using Google

Hans-Jörg Bibiko bibiko at eva.mpg.de
Mon Apr 30 22:25:04 UTC 2007


On 30.04.2007, at 21:27, Andy Herbert wrote:

>> Hi,
>>
>> I found a tiny error. Here the corrected utf-8 version of gspell.
>>
>> BTW In addition to that it is very easy to write out all google
>> suggestions delimited by a '|' within the multiple word spell
>> checking. With the help of a small command which shows this list as
>> pull-menu you can edit each error very handy ;)
>>
>> Cheers,
>>
>> Hans
>
> Thanks Hans, before reading your recent replies with the attached  
> files, I had already started work on UTF-8 version with
> [...]
> Support directory in the Textmate bundle (this means that I can no  
> longer supply it as a singular tmCommand), I genuinely do not know  
> if this is a better method for handling this sort of thing -  
> perhaps someone on this list could help clarify.
>

Your approach is more general.
BTW I do not believe that gspell returns html entities like ü.  
It returns the hex code, I believe.

But anyway executing your code against a German text I get the  
following error messages if the text contains German umlauts (äöü):
/tmp/temp_textmate.Rn3S55:24:in `unpack': malformed UTF-8 character  
(expected 2 bytes, given 1 bytes) (ArgumentError)
	from /tmp/temp_textmate.Rn3S55:24:in `encodeUTF'
	from /tmp/temp_textmate.Rn3S55:22:in `gsub'
	from /tmp/temp_textmate.Rn3S55:22:in `encodeUTF'
	from /tmp/temp_textmate.Rn3S55:27

This error messages are shown if you add the line: 'print encodeUTF 
($text)'
I did this because nothing happens as long as I had German umlauts in  
the text and I looked for the request string.

On the other hand I have a problem with '\n\n' in the text.

> Incidentally, I think there was an error in the original version  
> which was inherited by the version you've supplied - the final tab  
> stop was not being preserved, to correct this remove the line 'text  
> += "$0"' and replace 'print $text' with 'print "#{$text}$0"'.

Yes, OK.

Cheer,

Hans




More information about the textmate mailing list