summaryrefslogtreecommitdiff
path: root/libiconv/iconv.c
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@uclibc-ng.org>2018-01-28 18:47:12 +0000
committerWaldemar Brodkorb <wbx@uclibc-ng.org>2018-01-31 18:43:04 +0000
commit6018c3787ab9cebcddd039702ddf3c7127651cde (patch)
tree6fac6408186bb0b6bc545e7a9f6e2f9540a2ab66 /libiconv/iconv.c
parent795d6102e9a87f77c3fae065ae7cc7d9e3131522 (diff)
libiconv: fake EUC_JP support
A lot of packages use the same autoconf macro, fake EUC_JP to succeed. Tested with wget,libcdio and gnupg.
Diffstat (limited to 'libiconv/iconv.c')
-rw-r--r--libiconv/iconv.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libiconv/iconv.c b/libiconv/iconv.c
index cb4e94775..c028f0a51 100644
--- a/libiconv/iconv.c
+++ b/libiconv/iconv.c
@@ -30,6 +30,7 @@
#define LATIN_9 010
#define TIS_620 011
#define JIS_0201 012
+#define EUC_JP 013
/* some programs like php need this */
int _libiconv_version = _LIBICONV_VERSION;
@@ -51,12 +52,13 @@ static const unsigned char charsets[] =
"\011" "ISO-8859-11""\0"
"\011" "TIS-620" "\0"
"\012" "JIS-0201" "\0"
+ "\013" "EUC-JP" "\0"
"\377";
/* separate identifiers for sbcs/dbcs/etc map type */
#define UCS2_8BIT 000
#define UCS3_8BIT 001
-#define EUC 002
+#define EUC_JP 002
#define EUC_TW 003
#define SHIFT_JIS 004
#define BIG5 005
@@ -71,7 +73,7 @@ static const unsigned char charsets[] =
static const unsigned short maplen[] = {
[UCS2_8BIT] = 4+ 2* 128,
[UCS3_8BIT] = 4+ 3* 128,
- [EUC] = 4+ 2* 94*94,
+ [EUC_JP] = 4+ 2* 94*94,
[SHIFT_JIS] = 4+ 2* 94*94,
[BIG5] = 4+ 2* 94*157,
[GBK] = 4+ 2* 126*190,
@@ -345,7 +347,7 @@ size_t iconv(iconv_t cd, char **in, size_t *inb, char **out, size_t *outb)
case UCS2_8BIT:
c -= 0x80;
break;
- case EUC:
+ case EUC_JP:
if ((unsigned)c - 0xa1 >= 94) goto ilseq;
if ((unsigned)in[0][1] - 0xa1 >= 94) goto ilseq;
c = (c-0xa1)*94 + (in[0][1]-0xa1);