Bug 147342 - mtp file transfert function does not handle file encoding correctly (mtpmediadevice.cpp)
Summary: mtp file transfert function does not handle file encoding correctly (mtpmedia...
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Collections/MTP player (other bugs)
Version First Reported In: 1.4.7
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Amarok Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-29 04:54 UTC by Eric Grenier
Modified: 2011-12-20 11:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
patch to pinpoint the problem. Make use of utf8() instead of latin1(). (857 bytes, patch)
2007-06-29 04:55 UTC, Eric Grenier
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Grenier 2007-06-29 04:54:13 UTC
Version:            (using KDE KDE 3.5.7)
Installed from:    Gentoo Packages
Compiler:          gcc 3.4.6 
OS:                Linux

Amarok (v1.4.6) can not transfert files with UTF8 encoding characters to MTP device.

MTP device used: Samsung YP-KJAB

Tested features :
Amarok can connect to the MTP device.
Amarok can retrieve informations (folder structure and files) from MTP device.
Amarok can transfert file with fully qualified path in standard ASCII.
** Amarok can not transfert file with accents in the fully qualified path (éàè...)

While looking at the amarok trace (debug flag), the output from component [MtpMediaDevice] clearly shows characters differents then the file system representation :

BEGIN: virtual MediaItem* MtpMediaDevice::copyTrackToDevice(const MetaBundle&)
amarok:   [MtpMediaDevice] filetype : 1
amarok:   [MtpMediaDevice] Folder path : Jean Leloup - Le Dôme/
amarok:   [MtpMediaDevice] Parent id : 536870937
amarok:   [MtpMediaDevice] Sending track... /xx/xx/Jean Leloup/1996 - Le D?me/10 - Le D?me.mp3

Since the main folder of my music collection was in a folder with a non ascii chars, my MTP device was not usable with Amarok.

I have created a quick and dirty patch to show how I temporary solved the problem by using UTF8 instead of QString latin conversion.

Locale used:

LANG=fr_CA.UTF-8
LC_CTYPE=fr_CA.UTF-8
LC_NUMERIC=fr_CA.UTF-8
LC_TIME=fr_CA.UTF-8
LC_COLLATE=fr_CA.UTF-8
LC_MONETARY=fr_CA.UTF-8
LC_MESSAGES=fr_CA.UTF-8
LC_PAPER=fr_CA.UTF-8
LC_NAME=fr_CA.UTF-8
LC_ADDRESS=fr_CA.UTF-8
LC_TELEPHONE=fr_CA.UTF-8
LC_MEASUREMENT=fr_CA.UTF-8
LC_IDENTIFICATION=fr_CA.UTF-8
LC_ALL=

See attached patch.
Comment 1 Eric Grenier 2007-06-29 04:55:32 UTC
Created attachment 20989 [details]
patch to pinpoint the problem. Make use of utf8() instead of latin1().
Comment 2 Eric Grenier 2007-06-30 07:00:37 UTC
Comment on attachment 20989 [details]
patch to pinpoint the problem. Make use of utf8() instead of latin1().

>Index: amarok/src/mediadevice/mtp/mtpmediadevice.cpp
>===================================================================
>--- amarok/src/mediadevice/mtp/mtpmediadevice.cpp	(revision 681166)
>+++ amarok/src/mediadevice/mtp/mtpmediadevice.cpp	(working copy)
>@@ -295,9 +295,9 @@
>     debug() << "Parent id : " << parent_id << endl;
> 
>     m_critical_mutex.lock();
>-    debug() << "Sending track... " << bundle.url().path().latin1() << endl;
>+    debug() << "Sending track... " << bundle.url().path().utf8().data() << endl;
>     int ret = LIBMTP_Send_Track_From_File(
>-        m_device, bundle.url().path().latin1(), trackmeta,
>+        m_device, bundle.url().path().utf8().data(), trackmeta,
>         progressCallback, this, parent_id
>     );
>     m_critical_mutex.unlock();
Comment 3 mrdocs 2007-10-01 00:17:31 UTC
I can confirm this issue with Suse 10.2 and Amarok 1.4.7
Comment 4 Eric Valette 2008-03-29 18:57:28 UTC
I can confirm this bug on debian sid and Amarok 1.4.8. 

LANG=fr_FR@euro
LC_CTYPE="fr_FR@euro"
LC_NUMERIC="fr_FR@euro"
LC_TIME="fr_FR@euro"
LC_COLLATE="fr_FR@euro"
LC_MONETARY="fr_FR@euro"
LC_MESSAGES="fr_FR@euro"
LC_PAPER="fr_FR@euro"
LC_NAME="fr_FR@euro"
LC_ADDRESS="fr_FR@euro"
LC_TELEPHONE="fr_FR@euro"
LC_MEASUREMENT="fr_FR@euro"
LC_IDENTIFICATION="fr_FR@euro"
LC_ALL=

All files with french specific character not supported in latin1 in song title are not transferred.
Comment 5 Lydia Pintscher 2008-08-06 00:58:09 UTC
Alejandro can you please comment on this?
Comment 6 Alejandro Wainzinger 2008-08-06 01:06:35 UTC
Copying UTF8 files works perfectly in 2.0, but will not fix retroactively, sorry.
Comment 7 Lydia Pintscher 2008-08-06 01:09:58 UTC
Thanks Alejandro. Amarok 2 was all I wanted to know :)