Bug 295068 - playing a file with accents in name makes recent.xml grow without limit from then on
Summary: playing a file with accents in name makes recent.xml grow without limit from ...
Status: RESOLVED FIXED
Alias: None
Product: kmplayer
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Koos Vriezen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-29 13:47 UTC by Jonathan Marten
Modified: 2012-02-29 21:05 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 Jonathan Marten 2012-02-29 13:47:58 UTC
Version:           unspecified (using Devel) 
OS:                Linux

Playing a file that has accents in its name (need not be Unicode;  any ISO-8859-1 high half character will do) writes its URL to share/apps/kmplayer/recent.xml.  On every subsequent run of kmplayer, the representation of that URL appears to be corrupted.  After a few more runs, the file approximately doubles in size every time and soon affects the startup/shutdown performance of kmplayer.  This problem perists without limit until the recent.xml file is removed.

Starting with an empty file, after playing one media file with a single accented character in its name (file pathnames shortened):

<playlist>
 <item url="/d/23 - Der Maulwurf in der WÃŒste.avi"/>
</playlist>

After playing another file:

<playlist>
 <item url="/d/25 - Der Maulwurf auf dem Karneval.avi"/>
 <item url="/d/23 - Der Maulwurf in der WÃ<83>ÂŒste.avi"/>
</playlist>

After playing a third file:

<playlist>
 <item url="/d/33 - Der Kleine Maulwurf und die Freundschaft.avi"/>
 <item url="/d/25 - Der Maulwurf auf dem Karneval.avi"/>
 <item url="/d/23 - Der Maulwurf in der WÃ<83>Â
<83>Ã<82>ÂŒste.avi"/>
</playlist>

After a fourth file:

<playlist>
 <item url="/d/28 - Der Maulwurf und die Medizin.avi"/>
 <item url="/d/33 - Der Kleine Maulwurf und die Freundschaft.avi"/>
 <item url="/d/25 - Der Maulwurf auf dem Karneval.avi"/>
 <item url="/d/23 - Der Maulwurf in der WÃ<83>Â
<83>Ã<82>Â<83>Ã<83>Â<82>Ã<82>ÂŒste.avi"/>
</playlist>

After playing about 20 files, the file has grown to 1.1Mb in size of which most is taken up by the enormously long last <item> element.  Now it is noticeable that kmplayer takes a few seconds to start up or close.  After playing a few more files, it is unusable.


Reproducible: Always

Steps to Reproduce:
Start with an empty recent.xml file, play a media file that has an accented character in its name.  Now play some more files, and observe the size and contents of the recent.xml file after each run.


Actual Results:  
The file grows in size every time, and kmplayer performance is affected.


Expected Results:  
The application should behave.


The output above is from less (which shows high-half characters as <hex>).
Comment 1 Jonathan Marten 2012-02-29 14:05:02 UTC
Workaround:

rm .kde/share/apps/kmplayer/recent.xml
touch .kde/share/apps/kmplayer/recent.xml
chmod 000 .kde/share/apps/kmplayer/recent.xml

This does not affect the "Open Recent" operation, because that list is stored in [Recent Files] in .kde/share/config/kmplayerrc
Comment 2 Koos Vriezen 2012-02-29 19:43:31 UTC
Looks like QTextStream didn't detect the UTF8 encoding. KMPlayer writes out these files in UTF8 and expects QTextStream to detect that.
When your LANG env setting not is set to a UTF8 variant, it may perhaps fallback to ISO-8859-1.

You didn't specify a version, so did you compile it yourself? If so, then please try adding 

 inxml.setCodec("UTF-8");

in src/kmplayer_lists.cpp FileDocument::readFromFile after the line

 QTextStream inxml (&file);
Comment 3 Jonathan Marten 2012-02-29 20:53:29 UTC
Yes, self compiled (SVN r1281865).

LANG=C
KDE_LANG=en_GB

...because there are some non-KDE applications that I need to use that still don't like Unicode locales :-(

Adding the setCodec() as described appears to solve the problem.
Many thanks for the quick fix!
Comment 4 Koos Vriezen 2012-02-29 21:05:03 UTC
SVN commit 1282917 by vriezen:

Set codec to utf8 when reading our own lists

Apparently QTextStream doesn't detect it on non-utf8 locales


 M  +1 -0      kmplayer_lists.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1282917