Problems with KDE_stat on systems where the default locale is not utf-8

Christian Ehrlicher Ch.Ehrlicher at
Thu Nov 20 05:58:08 GMT 2008

Thiago Macieira schrieb:
> Christian Ehrlicher wrote:
>> Hi,
>> When QFile::encodeName() can't convert an unicode character into the
>> system locale (== all locales except utf-8), the non-convertable
>> character is replaced by a question mark. Now that the filename is
>> broken, KDE_stat() can't do anything usefull and fails.
>> For me looks like KDE_stat() and others are broken by design (when
>> system locale is not utf-8) and we need a unicode version of KDE_stat().
>> Any ideas how to fix this issue? Maybe a new class KLocalFile which
>> wraps all KDE_foo functions?
> We don't fix that issue. We only support KDE 4 in systems where the locale 
> is UTF-8. We've announced and told the public about this for 3 years now.
> I converted my system to UTF-8 over 5 years ago. All distributions ship 
> UTF-8 locales by default. I doubt any of the systems that, in the past, 
> didn't use UTF-8 are able to compile KDE 4 today (gcc 3.4 minimum, 4.0 
> recommended). And MacOS X's only locale is UTF-8.
> The only solution I have found so far for it is to add a QUrl-based API to 
> QFile/QFileInfo/QDir and the file engines. QUrl can hold any arbitrary 
> binary data as part of the pathname, and in 4.5 even raw slash characters 
> that are not directory separators.
> However, that breaks on Windows, where you can't have binary random data 
> on the pathnames. First, the Win32 API is already in Unicode. Second, 
> there are strict (and arbitrary) limitations on what characters are 
> allowed in a path component.
Reading your mail again I think you misunderstood me:

I've a perfectly valid filename in my QString/QUrl/KUrl. This file does 
exist and can be opened by all windows apps (and also all Qt-only apps) 
but *not* with KDE-apps because we use QFile::encodeName() instead 
passing the QString/QUrl to a platform dependend function. I can't 
explain an user why he can't open that file with a kde/windows app but 
with a qt-only one...


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 258 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the kde-core-devel mailing list