Hi everybody,
I'm new to this list, rather new to Ruby, and only a couple of weeks into my
dancing with Shoes...

So far, it's been a pleasure. We are using Shoes for an
ActiveResource-client to a Rails backend, which more or less works, after a
rough start with Gem dependencies.

But - somehow - UTF8 is not handled with enough care in the EditBox- and
ListBox-elements.Examples:

A): I'm feeding the ListBox with a list of (danish) daycare institutions.
They are fetched by Institution, an ActiveResource class, and delivered in
UTF8 - i've tested the output in the console, and it works.

B): But when they are rendered inside ListBox or EditBox - they are all
scrambled.

Example institutions could be 'Nattergalen Brøderup, Tappernøje' and
'Manøhytten, Næstved', which are shown nicely in the info and rendered
correctly as "Nattergalen Bræderup, Tappernøje' and 'Manøhytten, Næstved' in
the para, but not so in the ListBox (and the EditBox).

Could you please help me with getting UTF8 to behave inside those elements?
Thanks in advance!

Kind regards, Gissur

NB -
Here is a working extract of the code - you would still need a Rails server
to get ActiveResources working so I've mocked the code a bit, and commented
ARest-parts out:

Shoes.setup do
  gem 'activeresource'
  gem 'activesupport'
end

require 'rubygems'
require 'yaml'
require 'active_resource'
require 'active_support'

#class Institution < ActiveResource::Base
#  self.site = 'http://localhost:3000/'
#end

Shoes.app do
  insts_array = ["nothing chosen"]
  arest_array = ['Nattergalen Brøderup, Tappernøje','Manøhytten,
Næstved']
# works with ActiveResource
#  Institution.find(:all).each do |item|
#    info "Institution (in utf8?): #{item.name}"
#    insts_array << item.name
#  end

  arest_array.each do |item|
    info "Institution (in utf8?): #{item}"
    insts_array << item
  end

  flow :align => "left" do
    para "Choose"
    list_box :items => insts_array,:width => 240, :margin_left => 10,
:choose => "nothing chosen" do |list|
      @choice.text = list.text
    end
    @choice = para "Nothing chosen", :margin_left => 10
  end

  button "OK" do |click|
    stack :margin_left => 10, :width=> 600  do
      @form = edit_box :width => 700, :height => 700 do |editing|
        info "#{editing.text}"
      end
      @form.text = <<-HERE
        You selected [EMAIL PROTECTED] in the menu
      HERE
    end
  end

end

Reply via email to