diff options
author | Luo Jinghua <sunmoon1997@gmail.com> | 2010-01-09 00:39:40 +0800 |
---|---|---|
committer | Luo Jinghua <sunmoon1997@gmail.com> | 2010-01-09 00:39:40 +0800 |
commit | b046b4ad7e01c186470497ebba60c49ae1d8e8d7 (patch) | |
tree | 5f5502866abcbddff73e6389c0b6fe74e43f5252 | |
parent | ee958d0cef0cb03f071dea7e180a76823da327cd (diff) |
uniconv: support ignore mode
-rw-r--r-- | uniconv.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; |