Skip to content

Instantly share code, notes, and snippets.

@sjorz
Created December 19, 2012 02:08
Show Gist options
  • Save sjorz/4333792 to your computer and use it in GitHub Desktop.
Save sjorz/4333792 to your computer and use it in GitHub Desktop.
MS Word character replacement, improved version
def replace_ms_word_characters(s)
s_new = ""
s.each_byte do |b|
cr = b.chr
cr = "*" if b == 0x95
cr = '"' if b == 0x93 || b == 0x94
cr = "'" if b == 0x91 || b == 0x92
s_new << cr
end
return s_new
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment