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

Christian Schmidt lists at ruby-forum.com
Thu Mar 5 04:14:36 EST 2009


Hi Alex,

thank you for the reply!

The Problem isn't reading the file but opening it...! The program throws 
an exception if, for instance, you try to drop the file in the attached 
zip onto it.

My program will read in mp3-files and examine them with id3lib-ruby, so 
I don't have influence on the file's contents anyway.

Thanks in advance,
Christian.


Alex Fenton wrote:
> 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

-- 
Posted via http://www.ruby-forum.com/.


More information about the wxruby-users mailing list