aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/charset.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/charset.c b/src/charset.c
index a7522c4cf4e..4bad7b5ab28 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1535,6 +1535,23 @@ str_as_multibyte (str, len, nbytes, nchars)
1535 return (to - str); 1535 return (to - str);
1536} 1536}
1537 1537
1538/* Parse unibyte string at STR of LEN bytes, and return the number of
1539 bytes it may ocupy when converted to multibyte string by
1540 `str_to_multibyte'. */
1541
1542int
1543parse_str_to_multibyte (str, len)
1544 unsigned char *str;
1545 int len;
1546{
1547 unsigned char *endp = str + len;
1548 int bytes;
1549
1550 for (bytes = 0; str < endp; str++)
1551 bytes += (*str < 0x80 || *str >= 0xA0) ? 1 : 2;
1552 return bytes;
1553}
1554
1538/* Convert unibyte text at STR of NBYTES bytes to multibyte text 1555/* Convert unibyte text at STR of NBYTES bytes to multibyte text
1539 that contains the same single-byte characters. It actually 1556 that contains the same single-byte characters. It actually
1540 converts all 8-bit characters to multibyte forms. It is assured 1557 converts all 8-bit characters to multibyte forms. It is assured