summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuo Jinghua <sunmoon1997@gmail.com>2010-01-09 00:39:40 +0800
committerLuo Jinghua <sunmoon1997@gmail.com>2010-01-09 00:39:40 +0800
commitb046b4ad7e01c186470497ebba60c49ae1d8e8d7 (patch)
tree5f5502866abcbddff73e6389c0b6fe74e43f5252
parentee958d0cef0cb03f071dea7e180a76823da327cd (diff)
uniconv: support ignore mode
-rw-r--r--uniconv.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/uniconv.c b/uniconv.c
index b0a1ccb..b41a716 100644
--- a/uniconv.c
+++ b/uniconv.c
@@ -63,9 +63,9 @@ uniconv_canonical_charset(const char *charset,
for (p = uniconv_strrstr(buf, "//"); p;
p = uniconv_strrstr(buf, "//")) {
- if (!strcmp(buf + 2, "ignore"))
+ if (!strcmp(p + 2, "ignore"))
*retmode |= UNICONV_MODE_IGNORE;
- else if (!strcmp(buf + 2, "translit"))
+ else if (!strcmp(p + 2, "translit"))
*retmode |= UNICONV_MODE_TRANSLIT;
*p = '\0';
}
@@ -172,8 +172,11 @@ uniconv_conv(uniconv_t *uc,
ucs4len = ucsbuf - &ucs4;
ucsbuf = &ucs4;
aoutbuf = *outbuf;
+
ret = uc->to->encode(uc->to, (const ucs4_t **)&ucsbuf, ucs4len,
outbuf, *outleft);
+ if (ret == UNICONV_EILSEQ && uc->mode & UNICONV_MODE_IGNORE)
+ ret = UNICONV_SUCCESS;
*outleft -= *outbuf - aoutbuf;
if (ret < 0)
break;