Mitchell Gould wrote:
> Henrik --- wrote:
>> I wouldn't use HTML entities in the database since you may display
>> them in other contexts than HTML/XML, and also get problems like this
>> one. So if possible, store the text in some unicode encoding in the
>> database, without entities.
>>
>> If you must use entities for some reason, I suppose you could just
>> decode them before passing to collection_select. I think
>> CGI.unescapeHTML is pretty limited, but there are libs:
>> http://www.google.com/search?q=ruby+decode+html+entities
>
> The problem no matter what I am using as encoding the form helper
> function form.collection_select changes the & to �.
>
> If I put the same code for the french accent on the page I get the
> correct output.
>
> Norvège => Norvège.
>
> I really just want to turn the html escaping off so that the characters
> are displayed properly.
>
> That would solve one of my problems. Why does rails make it so hard to
> do basic stuff with language?
I found a way around the problem. I am not sure if its the best
practices way but here it is
<%= form.collection_select( :country, @countries, :name, :name,
options ={ :prompt => t('services.req_form.country_prompt')}
).gsub('&', '&') %>
collection_select escapes the & used for my french character html
entity. So I replace all instances of the & with &. It works.
I would appreciate any comments if this is ok to do and if not what is a
better way.
Thanks
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"rails-i18n" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rails-i18n?hl=en.