[fxruby-users] again

Lyle Johnson lyle at lylejohnson.name
Mon Jan 5 15:28:20 EST 2009


On Jan 5, 2009, at 12:58 PM, Helmut Hagemann wrote:

> require 'fox16'
> require 'iconv'
>
>
> app = Fox::FXApp.new
>
> main = Fox::FXMainWindow.new(app, "EAN TOOL" ,nil,nil,Fox::DECOR_ALL, 
> 0,0,400,400,20,20,20,20)
> str="äöüÄÖÜß@€"
> button2=Fox::FXButton.new(main,str)
> button2.font =Fox::FXFont.new(app, "Arial", 15,Fox::FONTWEIGHT_BOLD)
> str=Iconv.iconv("UTF-8", "CP1252", str).to_s
> button3=Fox::FXButton.new(main,str)
> button3.font =Fox::FXFont.new(app, "Arial", 15,Fox::FONTWEIGHT_BOLD)
> #str=Iconv.iconv("UTF-8", "CP1252", str).to_s
> button1=Fox::FXButton.new(main,str)
> button1.font =Fox::FXFont.new(app, "Arial Unicode",  
> 15,Fox::FONTWEIGHT_BOLD)
> app.create
> main.show(Fox::PLACEMENT_SCREEN)
> app.run
>
> i think the way with Iconv is very short and so will integrate in  
> Fox16.so.

You seem to be assuming that if the program's running on Windows, that  
the incoming strings (here, _str_) will always be in CP1252 encoding,  
and otherwise it will be in ISO-8859-1 encoding. That's not  
necessarily true. There is no general way (that I know of?) to deduce  
how a particular string of bytes is encoded.


More information about the fxruby-users mailing list