Re: Patch: Fix for Bug 1164, 2nd try


Subject: Re: Patch: Fix for Bug 1164, 2nd try
From: Vlad Harchev (hvv@hippo.ru)
Date: Tue May 22 2001 - 05:31:41 CDT


On Tue, 22 May 2001, Hubert Figuiere wrote:

> According to Vlad Harchev <hvv@hippo.ru>:
> > On Tue, 22 May 2001, ha shao wrote:
> >
> >
> > > Patch to add codepage items for Chinese. Really useful?
> >
> > It would be nice to commit it.
> >
> > Also everywhere, CJK hackers told us that not all iconv
> > implementations know "CP950" and "CP936" under these names - if it's true for
> > iconv AW is linked with, fallback charset names "BIG5" and "GB2312" should be
> > used.
> >
> > So, I'd suggest to change the code as I did for Wv in text.c -
> >
> > #define CPNAME_OR_FALLBACK(destination,name,fallbackname) \
> > { \
> > static char* cpname = NULL; \
> > if (!cpname) \
> > { \
> > iconv_t cd = iconv_open(name,name); \
> > if (cd==(iconv_t)-1) \
> > { \
> > cpname = fallbackname; \
> > } \
> > else \
> > { \
> > cpname = name; \
> > iconv_close(cd); \
> > } \
> > }; \
> > destination = cpname; \
> > }
> >
> > And instead of something like this
> > m_szEncoding = "CP936";
> > something like this should be used:
> > CPNAME_OR_FALLBACK(m_szEncoding,"CP936","GB2312");
> >
> > Both switches should be modified (the one that maps encoding number to
> > charset name, and the one that maps font charset number to encoding name).
> > Could somebody fix this?
>
>
> The idea is good, but I find this time consuming.... since iconv check
> will be done each time encoding is changed to this value. I keep the idea
> in mind and find a smarter way to go.

 No, iconv check will be performed only once per session (and the charset name
to return will be cached in static variable).

 Best regards,
  -Vlad



This archive was generated by hypermail 2b25 : Sat May 26 2001 - 03:51:06 CDT