Nila
2012-Sep-11 08:02 UTC
How to convert the HTML entities into UTF-8 character set, in ruby 1.8.7
Hi, Is there away to convert the HTML entities into UTF-8 character set, in ruby 1.8.7? (For example, if we consider "ö", convert the entity number "ö" into "\303\266". Or at least converting the html entity to the character "ö" ) Thank you -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/j7VOKNziOYcJ. For more options, visit https://groups.google.com/groups/opt_out.
Matt Jones
2012-Sep-11 11:53 UTC
Re: How to convert the HTML entities into UTF-8 character set, in ruby 1.8.7
On Tuesday, 11 September 2012 04:02:22 UTC-4, Nila wrote:> > Hi, > > Is there away to convert the HTML entities into UTF-8 character set, in > ruby 1.8.7? > (For example, if we consider "ö", convert the entity number "ö" into > "\303\266". Or at least converting the html entity to the character "ö" ) > > Thank you >CGI.unescapeHTML may do what you''re looking for. --Matt Jones -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/4tnIh0u03igJ. For more options, visit https://groups.google.com/groups/opt_out.
Walter Lee Davis
2012-Sep-11 13:37 UTC
Re: How to convert the HTML entities into UTF-8 character set, in ruby 1.8.7
On Sep 11, 2012, at 4:02 AM, Nila wrote:> Hi, > > Is there away to convert the HTML entities into UTF-8 character set, in ruby 1.8.7? > (For example, if we consider "ö", convert the entity number "ö" into "\303\266". Or at least converting the html entity to the character "ö" )Here''s what I do: coder = HTMLEntities.new foo = coder.decode(foo) I tried CGI.unescapeHTML and hit some problems, but that might have been my source talking, since there were also custom entities declared in XML. Walter -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Nila
2012-Sep-12 05:26 UTC
Re: How to convert the HTML entities into UTF-8 character set, in ruby 1.8.7
Thanks alot for the responses. Could do it using HTMLEntities. On Tuesday, September 11, 2012 1:32:22 PM UTC+5:30, Nila wrote:> > Hi, > > Is there away to convert the HTML entities into UTF-8 character set, in > ruby 1.8.7? > (For example, if we consider "ö", convert the entity number "ö" into > "\303\266". Or at least converting the html entity to the character "ö" ) > > Thank you >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/-ItcsoKgHv4J. For more options, visit https://groups.google.com/groups/opt_out.