简体中文
converts to
简体中文
using this utility:
http://people.w3.org/rishida/scripts/uniview/conversion.php
Is there a way that I can get Ruby to do this for me?
Thanks!
Philip
···
--
Posted via http://www.ruby-forum.com/.
string = "简体中文"
p string.unpack("U*").map{ |c| c = "&##{c};"}.join =>
"简体中文"
I'm not sure what the " " is. Whitespace? Should be " " then.
Regards,
Dan
···
On Dec 11, 10:39 am, Philip Brocoum <philip.broc...@gmail.com> wrote:
简体中文
converts to
简体中文
using this utility:http://people.w3.org/rishida/scripts/uniview/conversion.php
Is there a way that I can get Ruby to do this for me?
Philip Brocoum wrote:
简体中文
converts to
简体中文
Is there a way that I can get Ruby to do this for me?
"简体中文"
=> "\347\256\200\344\275\223\344\270\255\346\226\207"
"简体中文".unpack('U*')
=> [31616, 20307, 20013, 25991]
"简体中文".unpack('U*').map {|c| "&#{c};"}
=> ["&31616;", "&20307;", "&20013;", "&25991;"]
"简体中文".unpack('U*').map {|c| "&#{c};"}.join
=> "&31616;&20307;&20013;&25991;"
···
--
Posted via http://www.ruby-forum.com/\.