ivangro has asked for the wisdom of the Perl Monks concerning the following question:

I'm developing a spell check app using Tk, but when I use latin characters the delete method throws the following error:
Malformed UTF-8 character

$textbox->SetCursor($textbox->index($index));
$textbox->delete("insert wordstart", "insert wordend");
$textbox->insert("insert wordstart", $word, 'error');

Basically what I'm trying to do is to replace the wrong spelled words with the same word in red to make visible the error, but if the word has latin chars, then the error is throwed.
Any ideas?
  • Comment on Tk text widget not working with latin chars

Replies are listed 'Best First'.
Re: Tk text widget not working with latin chars
by mr_mischief (Monsignor) on May 27, 2010 at 06:08 UTC
    You need to make sure your text coming into the spell checking routines is encoded in whatever encoding you've told the routines to check. If they are expecting UTF-8 and you get a Latin character outside of US ASCII, then there's already something wrong. Without some more idea of your code, data, and output I don't know what else to say.
Re: Tk text widget not working with latin chars
by Anonymous Monk on May 27, 2010 at 03:55 UTC
    Post small self contained program that demonstrates the problem :)