G ++ curly quotes do not display correctly in the console and the "Problems" list

I recently switched from Visual Studio to Eclipse CDT. I installed it beautifully, so the g ++ compiler from my Cygwin installation can find and compile my code without ado.

However, there is a minor complaint. Each time g ++ reports a warning or error, the curly single quotation marks ' and ' displayed as รขโ‚ฌหœ respectively รขโ‚ฌโ„ข . This seems like a character encoding problem; g ++ or Cygwin spills out character encodings that CDT or Eclipse dislike.

This is only the relevant Google result that I could find , but setting the C ++ LANG environment variable in the Eclipse settings to C.UTF-8 or en_US.UTF-8 has no effect.

Running C ++ from Cygwin directly shows curly single quotes. Is there any way to disable them at all? Is there any environment variable that I can set, or an argument that I can pass?

In the images

Eclipse shows hieroglyphs in different places:

Eclipse Problem Screen Eclipse Console Screen

Cygwin shows the correct characters (ignore the fatal error):

Cywgin shows symbol

+7
eclipse-cdt g ++ utf-8 cygwin character-encoding
source share
4 answers

Yes, you need to either force Eclipse to display UTF-8, or stop using Cygwin gcc. I do not know how to do the first, but you can do the latter by making sure gcc is running with something like LANG = en_US.ISO-8859-1.

+5
source share

According to gcc 4.0 release notes http://gcc.gnu.org/gcc-4.0/changes.html :

Dialog messages in English will now use Unicode quotes in UTF-8 locales. (Non-English messages have already used quotes suitable for the language in previous releases.) If your terminal does not support UTF-8, but you use the UTF-8 locale (such locales are used by default on many GNU / Linux systems), then you must set LC_CTYPE=C in the environment to disable this locale. Programs that analyze diagnostics and expect ASCII messages in English must set LC_ALL=C For more information, see Marcus Kun's explanation of Unicode quotes .

+3
source share

It worked for me too. The environment variable must be set in the Eclipse settings window in the C / C ++ / Build / Environment section. You need to add a new variable by clicking the "Add" button. The variable name must be set to LANG and the value is en_US.ISO-8859-1. Does anyone know what is causing the problem? Cygwin, Eclipse, gcc ???

+2
source share

Answer 2 worked better for me when using gcc in the cygwin rxvt terminal.

In my .bash_profile added:

# Disable unicode quotes for gcc

export LC_CTYPE = C

0
source share

All Articles