Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Mar 2002 01:32:14 +0800
From:      Yong-Jhen Hong <winard@ms11.url.com.tw>
To:        i18n@FreeBSD.ORG
Subject:   MB_CHAR_MAX in EUC encoding
Message-ID:  <20020327173214.GA668@winax.home>

next in thread | raw e-mail | index | archive | help
Hello all on freebsd-i18n,
Sorry first for someone may receive this letter twice.

I have tried to make a new locale setting (specifically, a LC_CTYPE
file) which is of EUC encoding, but it didn't work. After dumping codes
of some multibyte strings and their corresponding widechar strings, I
found only one of four codesets breaks - and it's byte length is 4,
which is lesser than the hard-coded length in euc.c (__mb_cur_max = 3).

This confuses me, does EUC really limit byte length of its codeset to 3?
I have made a patch to let this locale work (listed below), but if it
breaks something please let me know. Thank you!

Regards,
Yong-Jhen.

PS. The patch:

--- /usr/src/lib/libc/locale/euc.c      Mon Jun  5 05:47:39 2000
+++ euc.c       Thu Mar 28 01:01:29 2002
@@ -82,6 +82,7 @@
                free(rl);
                return (ENOMEM);
        }
+       __mb_cur_max = 0;
        for (x = 0; x < 4; ++x) {
                ei->count[x] = (int) strtol(v, &e, 0);
                if (v == e || !(v = e)) {
@@ -89,6 +90,8 @@
                        free(ei);
                        return (EFTYPE);
                }
+               if (__mb_cur_max < ei->count[x])
+                       __mb_cur_max = ei->count[x];
                while (*v == ' ' || *v == '\t')
                        ++v;
                ei->bits[x] = (int) strtol(v, &e, 0);
@@ -114,7 +117,6 @@
        }
        rl->variable_len = sizeof(_EucInfo);
        _CurrentRuneLocale = rl;
-       __mb_cur_max = 3;
        return (0);
 }

--
Yong-Jhen Hong <winard@ms11.url.com.tw>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-i18n" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020327173214.GA668>