[PATCH] Improve selecte Set Encoding (Automatic Detection for Japanese)
Simon Hausmann
hausmann at kde.org
Sun Jan 19 11:52:36 GMT 2003
On Sun, Jan 19, 2003 at 08:45:33PM +0900, Toshitaka Fujioka wrote:
> On Saturday 18 January 2003 17:22, Daisuke Kameda wrote:
> > On Saturday 18 January 2003 16:25, Toshitaka Fujioka wrote:
> > > On Saturday 18 January 2003 01:39, David Faure wrote:
> > > > Can you explain what it does (i.e. the idea behind it) ?
> > > > What was wrong with the old way? What's the improvement?
> > >
> > > Because, select Japanese Automatic Detection of old way used
> > > "Control Center -> Advanced ->Country & Language -> Country -> Japan.
> > > (KGlobal::locale()->languageList()[0] == "ja")
> > >
> > > This way is hard to use.
> > >
> > > User can choose it among Set Encoding in my patch.
> >
> > I think that it is easy to select Japanese Automatic Detection after
> > applying the patch rather than old way. But, probably, it will be more
> > better to set the default language of Automatic Detection by
> > "KGlobal::locale()->languageList()[0]".
>
> Ok, I added your suggested feature. But, I used
> QTextCodec::codecForLocale()->name();
>
> And I added Arabic, Baltic, CentralEuropean, Russian, Ukrainian,
> Greek, Hebrew, Turkish and WesternEuropean automatic
> detection feature.
>
> Please review.
[...]
+ khtml::Decoder::AutomaticDetectinonLanguage language;
+ const char* name = QTextCodec::codecForLocale()->name();
+ if ( name == "cp1256" || name == "iso-8859-6" ) {
+ language = khtml::Decoder::Arabic;
+ }
+ else if ( name == "cp1257" || name == "iso-8859-13" || name == "iso-8859-4" ) {
+ language = khtml::Decoder::Baltic;
+ }
+ else if ( name == "cp1250" || name == "ibm852" || name == "iso-8859-2" || name == "iso-8859-3" ) {
+ language = khtml::Decoder::CentralEuropean;
+ }
+ else if ( name == "cp1251" || name == "koi8-r" || name == "iso-8859-5" ) {
+ language = khtml::Decoder::Russian;
I doubt that this works, as it compares pointer addresses, not strings.
Simon
More information about the kfm-devel
mailing list