Skip to content

Instantly share code, notes, and snippets.

@brianjlandau
Created December 5, 2011 20:00
Show Gist options
  • Select an option

  • Save brianjlandau/1435109 to your computer and use it in GitHub Desktop.

Select an option

Save brianjlandau/1435109 to your computer and use it in GitHub Desktop.
Nokogiri what did you do to the text of this element!
(rdb:1) text = page.find('.my-class').base.native.content
"5000 ms"
(rdb:1) text.force_encoding("UTF-8")
"5000 ms"
(rdb:1) s = "5000 ms"
"5000 ms"
(rdb:1) s.force_encoding("UTF-8")
"5000 ms"
(rdb:1) text == s
false
(rdb:1) text.force_encoding("US-ASCII")
"5000\xC2\xA0ms"
(rdb:1) s.force_encoding("US-ASCII")
"5000 ms"
@jasonmp85
Copy link
Copy Markdown

Yeaaaaaah. hexdump might show you that this is a NO-BREAK SPACE character in the template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment