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

List:       kde-core-devel
Subject:    Re: Japanese support patch
From:       Lars Knoll <lars () trolltech ! com>
Date:       2001-02-06 10:20:00
[Download RAW message or body]

On Tuesday 06 February 2001 00:43, Christian Gebauer wrote:
> Lars Knoll wrote:
> > On Monday 05 February 2001 15:40, Bernhard Rosenkraenzer wrote:
> > > Hi,
> > > the people at Red Hat Japan think this patch is required for Japanese
> > > support to work well in KDE 2.x - I don't have a clue about
> > > non-iso-8859-1 languages, so please check this...
> >
> > According to the bug report I could find about this in the kde bug list,
> > knode won't work without it. This is a bit strange, because it worked for
> > khtml, last time I tried. So my guess is rather that the problem is
> > somewhere else, perhaps in knode.
> >
> > Adding the patch would perhaps solve it for japanese, but then some other
> > language would have the same problem again. The charsets.config file has
> > the correct entries for shift-jis and iso-2022-jp, so it should work
> > without having to patch kcharsets.cpp. That's why I didn't apply this one
> > up to now.
>
> Jepp, it was a bug in KNode, I just fixed it. We used the stupid
> "convenience" method KCharsets::setQFont(QFont &f, QString charset) and
> assumed that it was equivalent to setQFont(fnt,
> KGlobal::charsets()->charsetForEncoding(c_harset)). But it uses nameToId()
> instead, so it worked only for some charset names. (I always wondered why
> articles encoded with windows-1251 didn't work :-/ ) Can we add a remark to
> the documentation of the convenience method that explains this problem?

Even better, we should make this equivalent. It's pitfall many people can 
fall over, and making the two ways above equivalent will probably save others 
from falling into it. It will not break anything for people using known 
encoding names.

Does the attached patch solve that problem and is it ok to apply it?

Lars

["kcharsets.diff" (text/plain)]

Index: kcharsets.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/kcharsets.cpp,v
retrieving revision 1.100
diff -u -r1.100 kcharsets.cpp
--- kcharsets.cpp	2001/01/26 15:53:36	1.100
+++ kcharsets.cpp	2001/02/06 10:19:06
@@ -447,7 +447,11 @@
 
 void KCharsets::setQFont(QFont &f, QString charset) const
 {
-    setQFont(f, nameToID(charset));
+    QFont::CharSet cs = nameToID(charset);
+    if ( cs == QFont::AnyCharSet ) {
+	cs = charsetForEncoding(charset);
+    }
+    setQFont( f, cs );
 }
 
 void KCharsets::setQFont(QFont &f, QFont::CharSet charset) const


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

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