Bug 58083 - KMid doesn't support international characters (AT ALL; I've checked source code and there are errors)
Summary: KMid doesn't support international characters (AT ALL; I've checked source co...
Status: RESOLVED UNMAINTAINED
Alias: None
Product: kmid
Classification: Miscellaneous
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Antonio Larrosa
URL:
Keywords:
: 33152 52188 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-05-04 00:02 UTC by Sergey A. Galin
Modified: 2010-04-02 16:04 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.2.2


Attachments
recodes lyrics from cp1251 to display properly (919 bytes, patch)
2003-07-23 08:54 UTC, Artem Astafyev
Details
KMid patch supporting national encodings. Tuned for Russian but can be changed to support other language by modifying one line. (4.43 KB, patch)
2003-07-23 12:06 UTC, Sergey A. Galin
Details
KMid internationalization patch! (9.73 KB, patch)
2003-07-23 20:44 UTC, Sergey A. Galin
Details
KMid internationalization patch r2 (9.84 KB, patch)
2003-07-23 22:32 UTC, Sergey A. Galin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sergey A. Galin 2003-05-04 00:02:24 UTC
Version:            (using KDE KDE 3.1.1)
Installed from:    Compiled From Sources
Compiler:          any 
OS:          Linux

Investigating how to make KMid playing Russian karaoke files, I've found that it doesn't support any non-ASCII characters. Not in lyrics nor in comments nor in file names nor in collection editor!!!!! Even if system locale is set to e.g. KOI8R, I cannot display any Cyrillic characters!

Investigating sources, I've found that the problem is because when KMid passes lyrics or filenames to GUI, it simply passes it as char* instead of calling QString::fromLocal8bit(). 

Unfortunately, I don't know enough about making patches and I don't know submit a fix myself :( It took me about 2 hours just to make it working for myself. However, any experienced programmer could make a fix in about half an hour.

It would be also great if someone added an option to select charset of karaoke lyrics manually from list because all karaoke files are in 8bit-ASCII, not UTF.
Comment 1 Sergey A. Galin 2003-07-08 16:02:23 UTC
For Russian users who wants to use Windows karaoke files, please also look at:
http://bugs.kde.org/show_bug.cgi?id=33152
http://sage.hellmachine.net/oss/KMid-Russian.php

Comment 2 Artem Astafyev 2003-07-23 08:54:21 UTC
Created attachment 2045 [details]
recodes lyrics from cp1251 to display properly

Here is a patch for kdemultimedia-3.1.1. It works for me  
fine. It may work for other versions, even you can try to  
modify sources by hands (only 2 additional lines and 1	
changed). I can't get Sergey Galin's sources, but as it seems 
he used recoding tables while mine used standart QT libraries 
capabilities.
Comment 3 Sergey A. Galin 2003-07-23 09:39:21 UTC
Yes, mine first uses table to convert lyrics from Windows-1251 and then calls
QString::fromLocale8Bit() to convert lyrics, so it is dependent on locale. I
found documentation on QTextCodec much later after I wrote that patch. I guess
Artem's patch is better for temporary solution although it still doesn't make
KMid internationalized.
Comment 4 Sergey A. Galin 2003-07-23 09:45:58 UTC
The URL I posted 2003-07-08 16:02 is wrong.

The address for my Russian KMid patch is:
http://sageshome.net/oss/KMid-Russian.php 
Comment 5 Sergey A. Galin 2003-07-23 10:03:23 UTC
Just checked new patch. Works perfectly for lyrics does not depend on locale
settings. But there are problems with file names containing non-ASCII
characters. For example, these files are dropped from collections after few
restarts of the program (somehow Russian letters get replaced with %HH
notation). Also, these names are not recoded properly for KMid's man window
caption. 

So, for users who have many files with Russian names it is more reasonable to
use my patch. If you are sure that all your filenames use latin characters only,
Artem's one will go better because it allows to use proportional fonts.

I wish I had time to make proper patches instead of all that temporarty stuff...
Comment 6 Thiago Macieira 2003-07-23 11:59:22 UTC
Again, both are hacks. 
 
The karaoke files we're talking about, they don't have any 
information on encoding, right? In that case, we should use 
QString::fromLocal8Bit and let it do the work. If you try to open a file 
that is not encoded in your locale, it won't work. 
 
The only way for it to work would be to do like Kate: select the 
encoding in the file open dialog. 
Comment 7 Thiago Macieira 2003-07-23 12:01:29 UTC
*** Bug 33152 has been marked as a duplicate of this bug. ***
Comment 8 Sergey A. Galin 2003-07-23 12:06:18 UTC
Created attachment 2046 [details]
KMid patch supporting national encodings. Tuned for Russian but can be changed to support other language by modifying one line.

Here is a new patch. Perfect Russian support including filenames stuff. 
For other languages, you have to change a line in kdisptext.cpp (from line 64):


 // SG
 // TODO: make this to select encoding from drop-down box
 lyrics_codec=QTextCodec::codecForName("CP1251");

Should be changed to
 
  lyrics_codec=QTextCodec::codecForName("your-encoding-name");

or

  lyrics_codec=QTextCodec::codecForLocale();

In latter case, the patch can be considered for official KMid version.
Comment 9 Sergey A. Galin 2003-07-23 12:12:27 UTC
Re 2 Thiago Macieira : Yes, there is no way to detect encoding of lyrics in
karaoke files. This makes big problem for Russian users, because 100% of Russian
karaoke files are encoded in CP1251 and cannot be displayed properly under
Linux. That's why I set up my Russian patch to consider that all files are in
CP1251. 

Complete solution would be to add combo-box with list of supported encodings to
main window so users could select charset manually (like in Web browser).
Comment 10 Sergey A. Galin 2003-07-23 20:44:45 UTC
Created attachment 2050 [details]
KMid internationalization patch!

I just couldn't stop! ;-)

Here is the 100% internationalized version with combo-box of available
encodings. By default encoding = system locale.

Bugs with improperly displayed file are names fixed too (thanks to Artem's
patch).

I hope to see the stuff in next KDE release!
Comment 11 Sergey A. Galin 2003-07-23 22:32:10 UTC
Created attachment 2051 [details]
KMid internationalization patch r2

Updated internationalization patch. I removed (commented out) all encodings
which were not actually working and "Hebrew, visually ordered" (crashed KMid).
Comment 12 Antonio Larrosa 2003-07-23 23:00:57 UTC
Subject: Re:  KMid doesn't support international characters (AT ALL; I've checked source code and there are errors)

El Mi
Comment 13 Antonio Larrosa 2003-08-29 12:29:10 UTC
*** Bug 52188 has been marked as a duplicate of this bug. ***
Comment 14 Waldo Bastian 2004-03-26 13:15:42 UTC
CVS commit by waba: 

Make kmid work with Russian files (BR58083)
Based on patch by Sergey A. Galin
CCMAIL: 58083-done@bugs.kde.org


  M +36 -18    kdisptext.cpp   1.32
  M +4 -1      kdisptext.h   1.17
  M +26 -12    kmidclient.cpp   1.82
  M +3 -1      kmidclient.h   1.32
  M +4 -1      main.cpp   1.27



Comment 15 Sergey A. Galin 2004-04-04 22:16:15 UTC
The patch still doesn't exist in KDE 3.2.1 :( Is it going be avaiable in the next "stable" release? I'm a bit tired to recompile kde-multimedia after each KDE upgrade... P.S. I put binaries for KDE 3.2.1 / ASP Linux 9.2 to http://sageshome.net/oss/KMid-Russian.php .
Comment 16 Sergey A. Galin 2004-05-26 20:56:36 UTC
Alex Chudnovsky reported that the patch was not properly applied in KDE 3.2.2!
He also made a patch to apply to KDE 3.2.2 to get the correct version. 

It can be downloaded from http://sageshome.net/oss/KMid-Russian.php; here is a download link:
http://sageshome.net/Download.php?url=ZG93bmxvYWRzL29zcy9rbWlkLWludDItR2FsaW4tQ2h1ZG5vdnNreS1LREUzLjIuMi0yMDA0MDUwNC5wYXRjaC5iejI=
Comment 17 Sergey A. Galin 2004-05-26 20:57:24 UTC
Oops, forgot to re-open...
Comment 18 George Goldberg 2008-02-18 03:54:39 UTC
Is this bug still present in a recent KDE version, such as 3.5.9 or 4.0.1?
Comment 19 Fitzcarraldo 2008-09-30 23:57:16 UTC
(In reply to comment #18)
> Is this bug still present in a recent KDE version, such as 3.5.9 or 4.0.1?
> 

Yes, this bug is still present. I am using KMid 2.0 on KDE 3.5.9 and KMid still does not display 'international' characters. For example, it does not display any characters that have diacritic marks, such as the acute accent (á), grave accent (à), tilde accent (ã), circumflex accent (â) or cedilla (ç) to name but a few. Thus lyrics in French, Spanish, Portuguese, Turkish, etc. are not displayed correctly by KMid. (This bug is surprising given that the author of KMid is Spanish.)
Comment 20 Unknown 2010-04-02 16:04:42 UTC
KMid 2.0 is now unmaintained.

There is a new KMid2 version for KDE4, released as KMid 2.2.2 in 2010 March 14th. It is a rewrite from scratch, with a different architecture and some new functionalities.

I'm closing this bug report because the old version is not going to be fixed, and the bug can't be reproduced in KMid2. Specifically, KMid2 handles many international character sets, most of them automatically. Some examples that have been tested are

Greek
http://www.greekmidi.com/songs/theodorakis/doxatotheo.html
http://www.greekmidi.com/songs/theodorakis/manamoukepanagia.html
Cyrillic
http://midi-karaoke.info/21cd09bd.html
http://midi-karaoke.info/21cd0bb1.html
Chinese/Korean
http://www.angelfire.com/ok/francisyeow/midi8.html

Please test. Thanks.