From 0729571314c28b9ee6669c6850a7e99f75964c98 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Tue, 21 Oct 2008 02:28:20 +0000 Subject: [PATCH] (detect_coding_charset): For iso-8859-* coding systems, check Vlatin_extra_code_table. --- src/ChangeLog | 5 +++++ src/coding.c | 16 +++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 042469a5049..64b988e7de4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-10-21 Kenichi Handa + + * coding.c (detect_coding_charset): For iso-8859-* coding systems, + check Vlatin_extra_code_table. + 2008-10-20 Eli Zaretskii * fileio.c (Fset_file_modes): Doc fix. diff --git a/src/coding.c b/src/coding.c index f7722f3212b..fb0bfa0b15c 100644 --- a/src/coding.c +++ b/src/coding.c @@ -4975,16 +4975,20 @@ detect_coding_charset (coding, detect_info) const unsigned char *src_end = coding->source + coding->src_bytes; int multibytep = coding->src_multibyte; int consumed_chars = 0; - Lisp_Object attrs, valids; + Lisp_Object attrs, valids, name; int found = 0; int head_ascii = coding->head_ascii; + int check_latin_extra = 0; detect_info->checked |= CATEGORY_MASK_CHARSET; coding = &coding_categories[coding_category_charset]; attrs = CODING_ID_ATTRS (coding->id); valids = AREF (attrs, coding_attr_charset_valids); - + name = CODING_ID_NAME (coding->id); + if (VECTORP (Vlatin_extra_code_table) + && strcmp ((char *) SDATA (SYMBOL_NAME (name)), "iso-8859-")) + check_latin_extra = 1; if (! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) src += head_ascii; @@ -5003,7 +5007,13 @@ detect_coding_charset (coding, detect_info) if (NILP (val)) break; if (c >= 0x80) - found = CATEGORY_MASK_CHARSET; + { + if (c < 0xA0 + && check_latin_extra + && NILP (XVECTOR (Vlatin_extra_code_table)->contents[c])) + break; + found = CATEGORY_MASK_CHARSET; + } if (INTEGERP (val)) { charset = CHARSET_FROM_ID (XFASTINT (val)); -- 2.39.5