Removing smart quotes from gcc output

A lot of programs can’t deal with the “smart quotes” gcc prints in it’s errors. If you have one program calling gcc and parsing the output, you might see something like:

foo.h:45: error: expected âââ}âââ at end of output

One fix I’ve found for this is to change the locale gcc uses for localization. You can do this using the LC_ALL environment variable (see the gcc man page). Setting its value to “C” normalizes the output to standard ASCII. In bash that’s:

export LC_ALL=C

Share on facebook
Share on twitter
Share on linkedin
Share on print
Share on email