Bug 190608

Summary: KIO::SlaveInterface reports non-Latin1 file name errors using wrong encoding
Product: [Unmaintained] kio Reporter: David Jarvie <djarvie>
Component: generalAssignee: David Faure <faure>
Status: RESOLVED FIXED    
Severity: normal CC: adawit, alex, anyr, chodorenko, maksim
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description David Jarvie 2009-04-25 11:42:06 UTC
Version:            (using KDE 4.2.2)
Compiler:          gcc 4.3 
OS:                Linux
Installed from:    Compiled From Sources

The application is using Phonon to access an audio file whose file name is in the Greek alphabet. This file name is shown correctly in the debug output for KIO::Slave::createSlave(), as below. When KIO errors due to not finding the file, it reports the file name using a Latin1 encoding instead of UTF8 or whatever. The debug output below shows this, but more importantly the error text which is emitted by KIO::SlaveInterface::dispatch() contains the file name in the wrong encoding too. As a result, error messages displayed to the user by the application are also wrong.


kalarm(9755)/kio (Slave) KIO::Slave::createSlave: createSlave "file" for KUrl("file:///home/fanisatt/Music/ΣΥΝΘΕΣΕΙΣ_MOY/LAST/Swallows of April_fin.wav")                                               
kalarm(9755)/kio (KIOConnection) KIO::ConnectionServer::listenForRemote: Listening on  "local:/tmp/ksocket-david/kalarmTJ9755.slave-socket"                                                             
kalarm(9755)/kio (KIOJob) KIO::SlaveInterface::dispatch: error  111   "/home/fanisatt/Music/ΣΥÎÎÎΣÎÎΣ_MOY/LAST/Swallows of April_fin.wav"
Comment 1 Maksim Orlovich 2009-04-25 16:45:12 UTC
Î = CE
£ = A3
.. Which decodes to U+03A3  GREEK CAPITAL LETTER SIGMA.
Comment 2 Maksim Orlovich 2009-04-25 16:49:35 UTC
.. What's your locale?
Comment 3 Maksim Orlovich 2009-04-25 18:34:52 UTC
Never mind --- spoke to thiago. Problem is that kio_file passes a QByteArray with encoded name to QString-taking method, and QString(QByteArray) by default does latin1.
Comment 4 Dawit Alemayehu 2011-05-14 20:06:43 UTC
Is this still applicable in KDE 4.6 or has the issue been resolved ?
Comment 5 Dawit Alemayehu 2011-05-26 03:29:29 UTC
(In reply to comment #3)
> Never mind --- spoke to thiago. Problem is that kio_file passes a QByteArray
> with encoded name to QString-taking method, and QString(QByteArray) by default
> does latin1.

There is nowhere where I see that happening in the current version of kio_file. That is I do not see a direct QByteArray to QString conversion. Either QFile::decodeName or KUrl's toLocalFile() is used to obtain the filename information sent in error messages. This is especially true for the error, ERR_DOES_NOT_EXIST (111), shown in the original report's debug output snippet.
Comment 6 David Jarvie 2011-07-30 19:44:08 UTC
As far as I can tell, this doesn't happen any more. I haven't managed to reproduce any of the KIO debug messages, but the error message returned by Phonon::MediaObject contains the correctly encoded file name, which is then displayed correctly to the user.
Comment 7 Nate Graham 2017-10-28 15:32:42 UTC
*** Bug 240427 has been marked as a duplicate of this bug. ***
Comment 8 Nate Graham 2017-10-28 15:32:53 UTC
*** Bug 185690 has been marked as a duplicate of this bug. ***
Comment 9 Nate Graham 2017-10-28 17:10:21 UTC
*** Bug 275289 has been marked as a duplicate of this bug. ***