Instantly share code, notes, and snippets.

Embed
What would you like to do?
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