Note that there are some explanatory texts on larger screens.

plurals
  1. POCyrillic Characters in Ruby Shoes using edit_line element
    primarykey
    data
    text
    <p>I have a strange problem using shoes. I have attached a screenshot of a very simple GUI I am building for a Ruby Script that I hope to use to assist me in learning the Russian language. However I am having a strange problem with Cyrillic characters. It seems that when I try to set the text of an edit_line I just get a question mark. Here is my complete code.</p> <pre><code>class Verb attr_accessor :infinitive,:present_first_sing,:present_second_sing,:present_third_sing,:present_first_plu,:present_second_plu,:present_third_plu def initialize(verb_infinitive) @infinitive = verb_infinitive case @infinitive when "думать" @present_first_sing,@present_second_sing,@present_third_sing,@present_first_plu,@present_second_plu,@present_third_plu = "думаю","думаешь","думает","думаем","думаете","думают" #puts "Added Dymat" when "смотреть" @present_first_sing,@present_second_sing,@present_third_sing,@present_first_plu,@present_second_plu,@present_third_plu = "смотрю","смотришь","смотрит","смотрим","смотрите","смотрят" #puts "Added Smatret" else puts "Dunno what to do with that dude" end end def get_available_conjugations answers = Hash.new answers["1st-sg-pres"] = @present_first_sing answers["2nd-sg-pres"] = @present_second_sing answers["3rd-sg-pres"] = @present_third_sing answers["1st-pl-pres"] = @present_first_plu answers["2nd-pl-pres"] = @present_second_plu answers["3rd-pl-pres"] = @present_third_plu return answers; end def to_s return @infinitive end end </code></pre> <p>This is my very simple verb class. Nothing Special here. My UI script is below</p> <pre><code>require "verb" verb1 = Verb.new("думать") verb2 = Verb.new("смотреть") quizVerbs = Hash.new quizVerbs[verb1.infinitive]=verb1 quizVerbs[verb2.infinitive]=verb2 qa_hash = Hash.new Shoes.app :width =&gt; 600, :height=&gt; 200 do stack do @flow1 = flow do para "Subject Verb: " @verb_list = list_box :items =&gt; quizVerbs.keys @verb_list.change do |vl| @current_verb = vl.text @p1.text = @current_conjugation end end @flow2 = flow do @p1 = para "#{@current_conjugation}" @user_input_box = edit_line :width =&gt; 400 @user_input_box.text = "й" @rwpara = para "Nothing answered yet" end @flow3 = flow do button("Next") do @rwpara.text = "" @user_input_box.text.each_codepoint {|c| @rwpara.text= @rwpara.text+c} end end @flow4 = flow do button("й") { @user_input_box.text = "й" alert("й") } button("ц") { @user_input_box.text = "ц" alert("ц") } button("у") { alert("Good job.") } button("к") { alert("Good job.") } button("е") { alert("Good job.") } button("н") { alert("Good job.") } button("г") { alert("Good job.") } button("ш") { alert("Good job.") } button("щ") { alert("Good job.") } button("з") { alert("Good job.") } button("х") { alert("Good job.") } button("ъ") { alert("Good job.") } end @flow5 = flow do button("ф") { alert("Good job.") } button("ы") { alert("Good job.") } button("в") { alert("Good job.") } button("а") { alert("Good job.") } button("п") { alert("Good job.") } button("р") { alert("Good job.") } button("о") { alert("Good job.") } button("л") { alert("Good job.") } button("д") { alert("Good job.") } button("ж") { alert("Good job.") } button("э") { alert("Good job.") } button("ё") { alert("Good job.") } end @flow6 = flow do button("я") { alert("Good job.") } button("ч") { alert("Good job.") } button("с") { alert("Good job.") } button("м") { alert("Good job.") } button("и") { alert("Good job.") } button("т") { alert("Good job.") } button("ь") { alert("Good job.") } button("б") { alert("Good job.") } button("ю") { alert("Good job.") } end end end </code></pre> <p><img src="https://i.stack.imgur.com/PjpO2.jpg" alt="russiangui"></p> <p>If I click on the button with character й I can see the character in the alert box is correctly displayed. However I assign the value to the text of the edit line in the code</p> <pre><code>button("й") { @user_input_box.text = "й" alert("й") } </code></pre> <p>However if you look at the gui again you can see that I am only getting a question mark to display. This is driving me nuts. What am I overlooking here?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload