On Mar 31, 4:27 pm, Nanyang Zhan <rails-mailing-l...@andreas-s.net>
wrote:
> Frederick Cheung wrote:
> > Well the difference is that the javascript stuff is produced UTF16 and
> > the ruby UTF8 (although the documentation I can find suggests that the
> > javascript should also be producing utf8).ith ruby code?
>
> Thank you for your replied. May be it is the true. But how can the utf16
> encodeURIComponent result to be the shorter?
Because for double byte characters utf16 is shorter than utf8.
>
> > The are various libraries for messing around with string encodings,
> > including iconv, and pack/unpack have some specifiers that are
> > relevant for unicode stuff, and rails itself also has various unicode
> > utilities in it.
>
> I tried to encode the string to utf-16 encoding before passing it to
> CGI.escape(), But I don't have any luck to production the same result as
> encodeURIComponent did. ( I got "%FE%FFN-e%87" from "中文")
>
> I find a perl and a python way to do encodeURIComponent on the net, and
> their are here:http://d.hatena.ne.jp/ruby-U/20081110/1226313786
>
> It is a pity that I don't know perl nor python. Can anyone figure out
> the ruby code for me from them?
>
Those aren't playing with encodings which is apparently the issue
here. Why does it matter anyway?
Fred
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---