Frederick Cheung wrote:
> well s.unpack("U*") will turn a string into a array of integers (utf
> code points) that it should then be easy to split into bytes. I'd
> start from scratch rather than using url_encode though.

Thanks! Fred.

>> "中文".unpack("C*")
=> [228, 184, 173, 230, 150, 135]
 > ERB::Util.url_encode("中文")
> => "%E4%B8%AD%E6%96%87"

For the first time,I have a little idea what url_encode is doing.

when:
>> "中文".unpack("U*")
=> [20013, 25991]

So, it is a way turning [20013, 25991] to '%D6%D0%CE%C4', right?

-- 
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 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to