From: Wisccal Wisccal Date: 2009-05-13T15:55:16+09:00 Subject: Re: converting UTF-8 to entities like 剛 Jian Lin wrote: > > I was trying to convert UTF-8 content into a series of entities like > 剛 so that whatever the page encoding is, the characters would > show... > If you are one 1.9, you could use String.codepoints. Something similar to: >> '威斯加的中文很不好'.codepoints.to_a.map {|e| "&#x#{e.to_s(16)};"} => ["威", "斯", "加", "的", "中", "文", "很", "不", "好"] HTH 威斯加 -- Posted via http://www.ruby-forum.com/.