Created
May 7, 2009 10:52
-
-
Save mudge/108051 to your computer and use it in GitHub Desktop.
Replace non-ASCII characters with their decimal-encoded XML entity.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Replace non-ASCII characters with their decimal-encoded XML entity. | |
str.gsub!(/[^\x00-\x7f]/) { |s| "&##{s.unpack("U")[0]};" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment