From: "Peña, Botp" Date: 2008-09-08T11:54:19+09:00 Subject: Re: convert ascii codes in a string to a string of characters From: smitty [mailto:cleesmith2006@gmail.com] # Is there a more efficient way to convert a string such as # "abcdef" to "abcdef" ? # # Currently I am doing the following: # a="abcdef" # a.delete!("&#") # ar = a.split(';') # arn = ar.collect { |s| Integer(s) } # s = arn.pack("U*") # puts "s=#{s.inspect}" i'm feeling good today ;) > "abcdef".delete("&#").split(";").map{|x| x.to_i}.pack("U*") => "abcdef" or > "abcdef".gsub(/\&\#(\d+);/){|x| $1.to_i.chr} => "abcdef" > require 'cgi' => false > CGI.unescapeHTML "abcdef" => "abcdef" kind regards -botp