[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: kcmdlineargs input decoding
From:       David Faure <faure () kde ! org>
Date:       2009-02-25 17:50:38
Message-ID: 200902251850.39470.faure () kde ! org
[Download RAW message or body]

On Wednesday 25 February 2009, Nick Shaforostoff wrote:
> Hi. Opening files with non-ASCII names via cmd line in any KDE app
> isn't possible on my system,
> as args are misencoded due to QString::fromLocal8Bit() returning
> different data before and after QApplication creation.
> 
> Attached patch fixes the issue by delaying conversion and moving it to
> KCmdLineArgs::arg(),
> as a side affect it switches KCmdLineArgs args processing to use
> QByteArray internaly,
> which is a little bit more memory efficient.

Very interesting. Good patch IMHO.

FWIW the attached patch fixes the issue too (qt-copy-trunk required, unpatched rc1
doesn't have the necessary exported symbol).

@@ -263,8 +264,10 @@                                                                              
     mStdargs = 0;                                                                                
                                                                                                  
     // Text codec.                                                                               
+    setlocale(LC_ALL, ""); // need to initialize "System" codec, i.e. iconv                      
+    extern Q_CORE_EXPORT bool qt_locale_initialized;                                             
+    qt_locale_initialized = true;                                                                
     codec = QTextCodec::codecForLocale();                                                        
-    setlocale(LC_ALL, ""); // need to initialize "System" codec, i.e. iconv                      
                                                                                                  
     // Qt options
     //FIXME: Check if other options are specific to Qt/X11

But if you found a way to delay all the locale8bit conversions, that's even better.
Please commit (to trunk).

-- 
David Faure, faure@kde.org, sponsored by Qt Software @ Nokia to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic