bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Solaris 8, gettext


From: Igor Brezac
Subject: Solaris 8, gettext
Date: Thu, 18 Apr 2002 05:16:50 GMT

Hello,

I am trying to build gettext-0.11.1 on Solaris 8 with the native iconv().
I developed iconv_open_wrapper() (see below) based on charset.alias and
this combination seems to work.
However, I am not completely satisified with this solution because the
code is included in too many places (quick and dirty solution).  Perhaps
libintl can provide this function.
Can you offer suggestions as to how to solve this issue?  GNU libiconv may
be a away to approach the problem, but the native iconv seem adequate.

Thanks,
-Igor

#define SIZEOF(a) (sizeof(a) / sizeof(a[0]))

static char *
get_vendor_charset(charset)
        const char *charset;
{
        int i;
        static const char *standard_vendor_charsets[] =
        {
                "ASCII", "646",
                "ISO-8859-1", "ISO8859-1",
                "ISO_8859-1", "ISO8859-2",
                "ISO-8859-2", "ISO8859-2",
                "ISO_8859-2", "ISO8859-3",
                "ISO-8859-3", "ISO8859-3",
                "ISO_8859-3", "ISO8859-4",
                "ISO-8859-4", "ISO8859-4",
                "ISO_8859-4", "ISO8859-5",
                "ISO-8859-5", "ISO8859-5",
                "ISO_8859-5", "ISO8859-6",
                "ISO-8859-6", "ISO8859-6",
                "ISO_8859-6", "ISO8859-7",
                "ISO-8859-7", "ISO8859-7",
                "ISO_8859-7", "ISO8859-8",
                "ISO-8859-8", "ISO8859-8",
                "ISO_8859-8", "ISO8859-9",
                "ISO-8859-9", "ISO8859-9",
                "ISO_8859-9", "ISO8859-13",
                "ISO-8859-13","ISO8859-13",
                "ISO_8859-13","ISO8859-15",
                "ISO-8859-15","ISO8859-15",
                "ISO_8859-15","ISO8859-15",
                "KOI8-R","KOI8-R",
                "KOI8-U","KOI8-U",
                "CP850","CP850",
                "CP866","CP866",
                "CP874","CP874",
                "CP1250","CP1250",
                "CP1251","CP1251",
                "CP1252","CP1252",
                "CP1253","CP1253",
                "CP1254","CP1254",
                "CP1255","CP1255",
                "CP1256","CP1256",
                "CP1257","CP1257",
                "EUC-JP","eucJP",
                "EUC-KR","EUC-KR",
                "EUC-TW","zh_TW-euc",
                "BIG5","BIG5",
                "GBK","GBK",
                "GB2312","gb2312",
                "SJIS","SJIS",
                "TIS-620","TIS620.2533",
                "UTF-8", "UTF-8"
        };

        for (i = 0; i < SIZEOF (standard_vendor_charsets); i+=2)
                if (strcasecmp (charset, standard_vendor_charsets[i]) == 0)
                        return standard_vendor_charsets[i+1];

        return NULL;
}

iconv_t
iconv_open_wrapper (t, f)
     const char *t;
     const char *f;
{
        char *from;
        char *to;

        if ((to = get_vendor_charset(t)) == NULL)
                return (iconv_t) -1;

        if ((from = get_vendor_charset(f)) == NULL)
                return (iconv_t) -1;

        return iconv_open(to, from);
}






reply via email to

[Prev in Thread] Current Thread [Next in Thread]