Bug 202393 - UTF8 doesn't work correctly
Summary: UTF8 doesn't work correctly
Status: RESOLVED NOT A BUG
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-03 15:35 UTC by Michel Grentzinger
Modified: 2009-08-06 14:56 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michel Grentzinger 2009-08-03 15:35:40 UTC
Version:            (using KDE 4.2.4)
Compiler:          gcc 
OS:                Linux
Installed from:    Debian testing/unstable Packages

Hello,

On my french system, I choose UTF-8 as codepage for my file in Kdevelop (Qt Apps). But if the caracters (like é, à, É, ê) are correct when I type them in the editor they are not correcly printed in my windows...

When I re-open the source file, they are badly printed.

Thanks,
Comment 1 Andreas Pakulat 2009-08-03 16:06:52 UTC
Kate does all the encoding-changes, hence re-assigning.
Comment 2 Michel Grentzinger 2009-08-05 21:13:03 UTC
I've resolved the encoding problem. All my editors is UTF8 ready now.

But the problem is still present at the compilation process. I've found this line on tab "Messages" when I compile my application.

cd '/home/michel/Programmes/Qt/chronoport/chrono6G' && LC_MESSAGES="C" LC_CTYPE="C" make -k

I think the problem is here !
Comment 3 Andreas Pakulat 2009-08-05 21:56:43 UTC
What exactly do you mean with "problem is still present in compilation process"? We're explicitly running make with C locale so that we get english messages from the compiler as those are the only ones that we can properly parse. If this influences the string in your application then you're code is wrong. Instead of something like:

label->setText( "MyTextWithé" )

you need to use

label->setText( QString::fromUtf8("MyTextWithé") )

if the file is properly encoded in UTF8.
Comment 4 Michel Grentzinger 2009-08-06 13:34:22 UTC
(In reply to comment #3)
> What exactly do you mean with "problem is still present in compilation
> process"? We're explicitly running make with C locale so that we get english
> messages from the compiler as those are the only ones that we can properly
> parse. If this influences the string in your application then you're code is
> wrong. Instead of something like:
> 
> label->setText( "MyTextWithé" )
> 
> you need to use
> 
> label->setText( QString::fromUtf8("MyTextWithé") )
> 
> if the file is properly encoded in UTF8.

That's right with fromUtf8() ! Thanks !

The user should be able to choose its locate. Is it possible in Kdevelop?
Comment 5 Andreas Pakulat 2009-08-06 14:56:37 UTC
(In reply to comment #4)
> The user should be able to choose its locate. Is it possible in Kdevelop?

No idea what you mean with that. Of course you can use whatever locale you want to run kdevelop in. However as I said the make-process will _always_ use C locale so we can analyze the output and instead of the overly verbose stuff like gcc -Wall -L -l ......... just show simple things like
Compiling foo.o