0

I'm testing a feature with watir and running into an issue with validating ascii characters in the html.

I'm grabbing the product description from a database like so 'Company® Some Product' and use it as the string that i'm validating against.

and it shows up that way in the html. However Ruby is looking for Company\u00AE Some Product, so my test is failing.

Anyone have any solutions for getting around these special characters when they turn up?

1
  • Unicode 00AE is the "registered" (r inside a circle) symbol. Commented Jan 20, 2012 at 19:51

1 Answer 1

1

HTML Entities gem may help:

http://htmlentities.rubyforge.org/

http://htmlentities.rubyforge.org/doc/

Sign up to request clarification or add additional context in comments.

2 Comments

There seems to be a mix of named (®) and decimal (&#226) in the data I'm drawing from. Using .decode seems to work for named, but it gets a different unicode value for the symbol. in rib : Staples\u00AE Cushing\u2122 Luxura\u00AE Manager's Chair, Black using .decode Staples\u00AE Cushing\u0099 Luxura\u00AE Manager's Chair, Black
You may have to use the existing code as a start and add to it. If you're lucky, doing a decode followed by encode may normalize things.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.