[wxruby-users] Incompatible encoding from drag and drop?

Alex Fenton alex at pressure.to
Wed Mar 4 18:41:21 EST 2009


Christian Schmidt wrote:
> I'm trying to get a little app running which receives filenames via drag
> and drop. While it mostly runs fine, when I'm dropping a file with e.g.
> german umlauts or french accents (è, é), I'm not able to open the file
> given by the droptarget-class. Seemingly the special characters get
> corrupted.
>   

You need to be sure that the text content of the file you're dropping in 
is in UTF-8 encoding. You should be able to set this in a text editor.

If the text isn't in UTF-8, you can read it then convert it to UTF-8 
using Ruby's iconv library.

> See the small attached program to reproduce my problem. I condensed it
> to the absolute minimum to evoke the error.

Also, you should return true or false from on_drop_files, to signal to 
wxRuby whether or not the drop files action succeeded.

hth
alex


More information about the wxruby-users mailing list