Displaying 1 result from an estimated 1 matches for "encoding_utf8".
2007 Aug 27
0
how can I get malformed UTF-8 characters to display properly?
...nd the "d" is
just swallowed.
data.gsub!(/\323/, ''"'')
require ''oniguruma''
o = Oniguruma::ORegexp.new(''[^[:ascii:]]'')
# o = Oniguruma::ORegexp.new(''[^[:ascii:]]'', {:encoding =>
Oniguruma::ENCODING_UTF8})
chars = []
data.each_char{|c|chars << c}
chars.collect do |c|
if o.match c
begin
"&##{c.unpack(''U*'').first};"
rescue ArgumentError
add_log_message("Has malformed UTF-8 characters")
#han...