Skip to content

Instantly share code, notes, and snippets.

@tbielawa
Created September 24, 2013 14:56
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tbielawa/6685995 to your computer and use it in GitHub Desktop.
Fix "RE error: illegal byte sequence" sed errors on OS X 10.7 when working with specially encoded characters. Read more on the blog: http://blog.lnx.cx/?p=403
@@ -2,4 +2,4 @@
# Translate Latin-1 smart quotes and en-dash into UTF-8. There is probably a
# better way to do this.
-LANG=C sed -e s/$'\x92'/$'\xe2\x80\x99'/g -e s/$'\x93'/$'\xe2\x80\x9c'/g -e s/$'\x94'/$'\xe2\x80\x9d'/g -e s/$'\x96'/-/g -e s/$'\xa0'/' '/g -e s/$'\xff'/' '/g
+LANG=C LC_ALL=C sed -e s/$'\x92'/$'\xe2\x80\x99'/g -e s/$'\x93'/$'\xe2\x80\x9c'/g -e s/$'\x94'/$'\xe2\x80\x9d'/g -e s/$'\x96'/-/g -e s/$'\xa0'/' '/g -e s/$'\xff'/' '/g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment