version 1.14, 2015/03/06 09:24:59 |
version 1.15, 2015/10/06 18:32:19 |
Line 92 preconv_encode(struct buf *ib, size_t *ii, struct buf |
|
Line 92 preconv_encode(struct buf *ib, size_t *ii, struct buf |
|
*oi += snprintf(ob->buf + *oi, 11, "\\[u%.4X]", accum); |
*oi += snprintf(ob->buf + *oi, 11, "\\[u%.4X]", accum); |
*ii = (char *)cu - ib->buf; |
*ii = (char *)cu - ib->buf; |
*filenc &= ~MPARSE_LATIN1; |
*filenc &= ~MPARSE_LATIN1; |
return(1); |
return 1; |
|
|
latin: |
latin: |
if ( ! (*filenc & MPARSE_LATIN1)) |
if ( ! (*filenc & MPARSE_LATIN1)) |
return(0); |
return 0; |
|
|
*oi += snprintf(ob->buf + *oi, 11, |
*oi += snprintf(ob->buf + *oi, 11, |
"\\[u%.4X]", (unsigned char)ib->buf[(*ii)++]); |
"\\[u%.4X]", (unsigned char)ib->buf[(*ii)++]); |
|
|
*filenc &= ~MPARSE_UTF8; |
*filenc &= ~MPARSE_UTF8; |
return(1); |
return 1; |
} |
} |
|
|
int |
int |
Line 123 preconv_cue(const struct buf *b, size_t offset) |
|
Line 123 preconv_cue(const struct buf *b, size_t offset) |
|
|
|
if ((sz = (size_t)(eoln - ln)) < 10 || |
if ((sz = (size_t)(eoln - ln)) < 10 || |
memcmp(ln, ".\\\" -*-", 7) || memcmp(eoln - 3, "-*-", 3)) |
memcmp(ln, ".\\\" -*-", 7) || memcmp(eoln - 3, "-*-", 3)) |
return(MPARSE_UTF8 | MPARSE_LATIN1); |
return MPARSE_UTF8 | MPARSE_LATIN1; |
|
|
/* Move after the header and adjust for the trailer. */ |
/* Move after the header and adjust for the trailer. */ |
|
|
Line 162 preconv_cue(const struct buf *b, size_t offset) |
|
Line 162 preconv_cue(const struct buf *b, size_t offset) |
|
sz--; |
sz--; |
} |
} |
if (0 == sz) |
if (0 == sz) |
return(0); |
return 0; |
|
|
/* Check us against known encodings. */ |
/* Check us against known encodings. */ |
|
|
if (phsz > 4 && !strncasecmp(ln, "utf-8", 5)) |
if (phsz > 4 && !strncasecmp(ln, "utf-8", 5)) |
return(MPARSE_UTF8); |
return MPARSE_UTF8; |
if (phsz > 10 && !strncasecmp(ln, "iso-latin-1", 11)) |
if (phsz > 10 && !strncasecmp(ln, "iso-latin-1", 11)) |
return(MPARSE_LATIN1); |
return MPARSE_LATIN1; |
return(0); |
return 0; |
} |
} |
return(MPARSE_UTF8 | MPARSE_LATIN1); |
return MPARSE_UTF8 | MPARSE_LATIN1; |
} |
} |