Bug 438328 - Warnings from g++ contain invalid characters
Summary: Warnings from g++ contain invalid characters
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc4
Version: 8
Hardware: i686
OS: Linux
low
low
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-03-20 12:42 UTC by Syam
Modified: 2008-03-20 13:43 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-03-20 12:54:03 UTC
Type: ---
Embargoed:


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

Description Syam 2008-03-20 12:42:37 UTC
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 12:42:37 UTC
Created attachment 298689 [details]
A test cpp file

Comment 2 Syam 2008-03-20 12:44:53 UTC
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 12:54:03 UTC
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
en_GB.iso885915).

Comment 4 Syam 2008-03-20 13:43:03 UTC
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 &&
LC_MESSAGES="C" LC_CTYPE="C" gmake
But isn't this locale setting supposed to be specific for the KDevelop build 
environment?



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