Red Hat Bugzilla – Bug 438328
Warnings from g++ contain invalid characters
Last modified: 2008-03-20 09:43:03 EDT
Description of problem:
I have a Qt project using KDevelop. Today I noticed that some compiler warnings
displayed in KDevelop have some invalid characters in them. I tried compiling
with g++ (did a make) in a separate terminal window. There were some invalid
characters (a u with two dots on top! German?) in the warnings produced by g++.
I redirected the warnings to a text file. The file looks perfectly OK with
konsole/vim/KWrite on KDE. But in the terminal, the characters are displayed.
I opened the file in a hex editor, and indeed the bytes e2 80 98 were present.
This problem was not present a few weeks back! I did a yum update two days back.
Version-Release number of selected component (if applicable):
gcc --version gives:
4.1.2 20070925 (Red Hat 4.1.2-33)
Create a new cpp file. Put some unused variables, and compile with -Wall.
Check the warning text!
Steps to Reproduce:
1. Create new cpp file, which will generate compiler warnings
2. Compile with g++ -O0 -Wall, in a terminal (not GUI)
3. Check the warnings
Warnings displayed in English (my language setting is English)
Warnings have invalud characters
I am attaching a simple cpp file (test.cpp)
The output of: g++ -o test -O0 -Wall -lm -pedantic test.cpp 2> ee.txt
Created attachment 298689 [details]
A test cpp file
Created attachment 298690 [details]
Warnings generated by compiling test.cpp
g++ -o test -O0 -Wall -lm -pedantic test.cpp 2> ee.txt
Open the file in a hex editor and the bytes e2 80 98 are there!
That means you have misconfigured terminal.
e2 80 98 is a valid UTF-8 character:
<U2018> /xe2/x80/x98 LEFT SINGLE QUOTATION MARK.
and GCC outputs it only if the current locale uses UTF-8 (e.g. en_US.UTF-8,
en_GB.UTF-8 etc.). If this displays as garbage in your terminal, it means your
terminal isn't in UTF-8 mode, but you are using UTF-8 locale. Either you need
to use terminal in UTF-8 mode with UTF-8 locale, or you should use a different
locale that matches the charset recognized by your terminal (e.g. en_GB.iso88591 or
Thanks for the info. But I wonder what made these 'changes'! I never had
problems with gcc output. I had installed pdated a few SCIM/Pango packages.
Could that cause this? And yes, my locale is en_US.UTF-8.
The problem occurs only when KDevelop/KWrite is started. If I close KDevelop
(and re-login in the terminal), the warnings are displayed correctly.
When building, Kdevelop does this:
cd '/usr/projects/director' && LC_MESSAGES="C" LC_CTYPE="C" gmake clean &&
LC_MESSAGES="C" LC_CTYPE="C" gmake
But isn't this locale setting supposed to be specific for the KDevelop build