Over a million developers have joined DZone.

Convert Unicode Characters To HTML Entities In Ruby

·

def entities( str )
  converted = []
  str.split(//).collect { |c| converted << ( c[0] > 127 ? "&##{c[0]};" : c ) }
  converted.join('')
end
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}