Frederick Cheung wrote:
> Those aren't playing with encodings which is apparently the issue
> here. Why does it matter anyway?
ok.
Here is the source code of ERB::Util.url_encode(s) method.
# File erb.rb, line 801
def url_encode(s)
s.to_s.gsub(/[^a-zA-Z0-9_\-.]/n){ sprintf("%%%02X",
$&.unpack("C")[0]) }
end
now it works like this:
> ERB::Util.url_encode("中文")
>
> => "%E4%B8%AD%E6%96%87"
Can you help me changing the url_encode code a bit, so it can return
utf16 result? ( which '%D6%D0%CE%C4' is the one I want.)
--
Posted via http://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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---