We help IT Professionals succeed at work.

Ruby HTML Entity Problem

R_O_B
R_O_B asked
on
498 Views
Last Modified: 2012-05-11
New to Ruby and am wondering how to get the following to print just the degree symbol...

require 'htmlentities'
coder = HTMLEntities.new
puts coder.decode('°')

Open in new window


Currently the command line (Windows) output is: °

Thanks!
Comment
Watch Question

Commented:
What version of Ruby are you running? And what version of HTMLEntities is installed? And what platform?

I just tried this with Ruby 1.9.2, htmlentities 4.3.0, Linux and it worked just fine - got the degree symbol printed.
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Commented:
Sorry; now I see that you're on Windows... I'll check that, too.

Commented:
Interesting; I normally run my ruby stuff under cygwin (www.cygwin.com) and in that environment, I again get only the single degree character; no Â. What's your specific windows environment?

Author

Commented:
No cygwin, just Ruby192 on Windows 7.

Author

Commented:
Answered on StackOverflow.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.