On Dec 11, 10:39 am, Philip Brocoum <philip.broc... / gmail.com> wrote:
> 简体中文
>
> converts to
>
> &#31616;&#20307;&#20013;&#25991;&#10;
>
> 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?

string = "简体中文"
p string.unpack("U*").map{ |c| c = "&##{c};"}.join =>
"&#31616;&#20307;&#20013;&#25991;"

I'm not sure what the "&#10;" is. Whitespace? Should be "&#32;" then.

Regards,

Dan