Bug 438328 - Warnings from g++ contain invalid characters
Warnings from g++ contain invalid characters
Product: Fedora
Classification: Fedora
Component: gcc4 (Show other bugs)
i686 Linux
low Severity low
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2008-03-20 08:42 EDT by Syam
Modified: 2008-03-20 09:43 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-03-20 08:54:03 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
A test cpp file (282 bytes, application/octet-stream)
2008-03-20 08:42 EDT, Syam
no flags Details
Warnings generated by compiling test.cpp (150 bytes, text/plain)
2008-03-20 08:44 EDT, Syam
no flags Details

  None (edit)
Description Syam 2008-03-20 08:42:37 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)

How reproducible:
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
Actual results:
Warnings displayed in English (my language setting is English)

Expected results:
Warnings have invalud characters

Additional info:
I am attaching a simple cpp file (test.cpp)
The output of: g++ -o test -O0 -Wall -lm -pedantic test.cpp 2> ee.txt
Comment 1 Syam 2008-03-20 08:42:37 EDT
Created attachment 298689 [details]
A test cpp file
Comment 2 Syam 2008-03-20 08:44:53 EDT
Created attachment 298690 [details]
Warnings generated by compiling test.cpp

Compile command:
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!
Comment 3 Jakub Jelinek 2008-03-20 08:54:03 EDT
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
Comment 4 Syam 2008-03-20 09:43:03 EDT
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.

Just discovered:
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 &&
But isn't this locale setting supposed to be specific for the KDevelop build 

Note You need to log in before you can comment on or make changes to this bug.