Field sets and unicode


#1

Hello gentlemen,

I’ve forced to such unicode problem:
I have:
<%= text_field_tag ‘search’, nil, :id => ‘search’, :size => 10 %>
<%= observe_field ‘search’,
:url => {:controller => ‘article’, :action => ‘search’},
:with => “‘terms=’ + escape(value)”,
:update => ‘search_results’,
:loading => “Element.show(‘search_spinner’)”,
:loaded => “Element.hide(‘search_spinner’)”
%>
in my article view, after sumbitting I get sequence like
u0444u0438u043bu043eu0441u043eu0444u0438u044f in controller
(params[:terms]).
How can I convert it into normal unicode? I am using UTF-8 as encoding.

Thanks,
Mikhail


#2

instead of escape()

:with => “‘terms=’ + escape(value)”,

use encodeURIComponent(), which should work fine with UTF8:

encodeURIComponent(‘Ñ?илосоÑ?ия’) =>
%D1%84%D0%B8%D0%BB%D0%BE%D1%81%D0%BE%D1%84%D0%B8%D1%8F

2006/1/29, Mikhail S. removed_email_address@domain.invalid:


#3

On Sun, 29 Jan 2006 15:17:12 +0200
Lugovoi N. removed_email_address@domain.invalid wrote:

instead of escape()

:with => “‘terms=’ + escape(value)”,

use encodeURIComponent(), which should work fine with UTF8

Thanks a lot, Nikolai!