[PATCH] Improve selecte Set Encoding (Automatic Detection for Japanese)

Toshitaka Fujioka toshitaka at crux.ocn.ne.jp
Sun Jan 19 14:25:25 GMT 2003


On Sunday 19 January 2003 20:52, Simon Hausmann wrote:
> 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.

Oops, your right. thank you for the advice. :)

I attached a new patch. 

Regards,
Toshitaka



-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdelibs-khtml-improve-selectSetEncoding-20030119.diff
Type: text/x-diff
Size: 22994 bytes
Desc: not available
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20030119/6ba60182/attachment.diff>


More information about the kfm-devel mailing list