From: Axel Etzold Date: 2008-08-19T06:44:34+09:00 Subject: Re: accented letters -------- Original-Nachricht -------- > Datum: Tue, 19 Aug 2008 00:21:51 +0900 > Von: angico > An: ruby-talk@ruby-lang.org > Betreff: accented letters > Hi, all. > > I'm developing an application using FXRuby and need to enter text that > has accented letters in it (portuguese texts). > > But the controls doesn't show the accented letters as I type them - just > the corresponding letter without the accent. > > I've captured SEL_KEYPRESS for a FXText control and I can see that it > "sees" as I type in the key with the accent, and then the key for the > letter I want to have accented. > > Here's an excerpt of the output of the captured event (the relevant > statement here is puts data.text << " (" << data.code.to_s << ")"): > > (65505) > < (60) > p (112) > (65505) > > (62) > (65505) > I (73) > s (115) > t (116) > o (111) > (32) > (65105) > e (101) > (32) > c (99) > e (101) > r (114) > t (116) > o (111) > (65505) > < (60) > / (47) > p (112) > (65505) > > (62) > > ------------------- > > I know that (65105) is the code for the left shift. (65105) would be the > code for the acute accent, which followed by the letter e (101) should > give me an "e acute" (�), but the control shows just the simple "e". > > Does anybody have a hint on this? > > TIA, > > -- > angico > ------ > home page: www.angico.org > Gnu/Linux, FLOSS, Espiritismo, e eu por mim mesmo 8^I > ------ > contatos: > email: angico@angico.org > skype: angico00 > ------ > Dear Angico, you'll need to convert your text to utf-8 encoding using Iconv. Have a look at this (somewhat randomly copied from a Wikipedia article about the Brazilian sociologist Gilberto Freyre) and the FXRuby tutorial: require "rubygems" require "iconv" require 'fox16' include Fox theApp = FXApp.new text = Iconv.iconv("utf-8","iso-8859-1","Interpreta��o do Brasil") p text theMainWindow = FXMainWindow.new(theApp, text[0]) text2="O Brasil do futuro n�o vai ser o que os velhos historiadores disserem e os de hoje repetem. Vai ser o que Gilberto Freyre disser. Freyre � um dos g�nios de palheta mais rica e iluminante que estas terras ant�rticas ainda produziram." message = Iconv.iconv("utf-8","iso-8859-1",text2) theButton = FXButton.new(theMainWindow, message[0]) theButton.connect(SEL_COMMAND) do |sender, selector, data| exit end theApp.create theMainWindow.show theApp.run Best regards, Axel -- Psssst! Schon das coole Video vom GMX MultiMessenger gesehen? Der Eine f�r Alle: http://www.gmx.net/de/go/messenger03