Hi John, this may or may not be useful but when I work with accented items
like these, I treat them like a black box. That is, I don't look into the
box to see how Ruby translates them .. which may or may not be how Ruby
really sees them. In your select_list, can you refer to that "service name"
item by index instead of by text?
Not being a real programmer, I don't know if how I do things is the right
way or not, but I make *a lot* of use of arrays. When I need to navigate
between names with accented characters, I drop all the contents into arrays
and then navigate by id and index numbers instead. Hashes are really good
to me sometimes.
I spent some time months ago doing the same kinds of code magic translations
that you are proposing below but I gave up in frustration after a few days.
In my case, it looked like what Ruby showed me and what it really saw were
not the same thing, so I found it was best not to look at all.
Again, this might not help you, but it's how I managed to get around a
similar problem. I don't know what your scripts do. My scripts just kind
of randomly choose whatever data they need on the fly so no two runs are
ever the same. I think the only data that I know my scripts reuse are the
user ID and password to log into the system. Everything else sits in
randomly-created or selected variables and arrays. I let Ruby work with
whatever data it finds.
I know. It's weird. But that's how I test, so I've programmed my scripts
to work the same way I do. ;-)
Best of luck! Cheers. Paul C.
On 02/03/07, John Lolis <[EMAIL PROTECTED]> wrote:
Looking for a bit of help here.
I have a select list that has the following value 'Nome do serviço'.
When I do select_list(whatever).text i get back 'Nome do servi\347o'
if i look in the source of the html i get 'Nome do serviço'
I also found code to convert 'Nome do serviço' to 'Nome do serviço'
(but thats not what ruby sees)
so...
I need a way to convert 'Nome do serviço' to 'Nome do servi\347o' (i
think...)
# Code to convert from 'Nome do serviço' to 'Nome do serviço'
# stolen from somwhere
def entities( str )
converted = []
str.split(//).collect { |c| converted << ( c[0] > 127 ? "&##{c[0]};" : c
) }
converted.join('')
end
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general