Convert 简体中文 in Chinese to 简体中文&

S

Suraj Kurapati

Philip said:
简体中文

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;"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,274
Messages
2,571,365
Members
48,049
Latest member
robinsonkoff

Latest Threads

Top