1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-21 05:00:47 -08:00

(detect_coding_iso_2022): Fix handling of SS2 and SS3.

(detect_coding): Treat '\0' as normal ASCII byte..
(detect_coding_system): Likewise.
This commit is contained in:
Kenichi Handa 2004-01-29 01:25:50 +00:00
parent c687637047
commit 75e2a25314

View file

@ -2616,20 +2616,21 @@ detect_coding_iso_2022 (coding, detect_info)
found |= CATEGORY_MASK_ISO_8_ELSE; found |= CATEGORY_MASK_ISO_8_ELSE;
goto check_extra_latin; goto check_extra_latin;
case ISO_CODE_SS2: case ISO_CODE_SS2:
case ISO_CODE_SS3: case ISO_CODE_SS3:
/* Single shift. */ /* Single shift. */
if (inhibit_iso_escape_detection) if (inhibit_iso_escape_detection)
break; break;
single_shifting = 1; single_shifting = 0;
rejected |= CATEGORY_MASK_ISO_7BIT; rejected |= CATEGORY_MASK_ISO_7BIT;
if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1]) if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1])
& CODING_ISO_FLAG_SINGLE_SHIFT) & CODING_ISO_FLAG_SINGLE_SHIFT)
found |= CATEGORY_MASK_ISO_8_1; found |= CATEGORY_MASK_ISO_8_1, single_shifting = 1;
if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_2]) if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_2])
& CODING_ISO_FLAG_SINGLE_SHIFT) & CODING_ISO_FLAG_SINGLE_SHIFT)
found |= CATEGORY_MASK_ISO_8_2; found |= CATEGORY_MASK_ISO_8_2, single_shifting = 1;
if (single_shifting)
break;
goto check_extra_latin; goto check_extra_latin;
default: default:
@ -2680,10 +2681,6 @@ detect_coding_iso_2022 (coding, detect_info)
found |= CATEGORY_MASK_ISO_8_1; found |= CATEGORY_MASK_ISO_8_1;
else else
rejected |= CATEGORY_MASK_ISO_8_1; rejected |= CATEGORY_MASK_ISO_8_1;
if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_2])
& CODING_ISO_FLAG_LATIN_EXTRA)
found |= CATEGORY_MASK_ISO_8_2;
else
rejected |= CATEGORY_MASK_ISO_8_2; rejected |= CATEGORY_MASK_ISO_8_2;
} }
} }
@ -5349,8 +5346,7 @@ detect_coding (coding)
for (i = 0, src = coding->source; src < src_end; i++, src++) for (i = 0, src = coding->source; src < src_end; i++, src++)
{ {
c = *src; c = *src;
if (c & 0x80 || (c < 0x20 && (c == 0 if (c & 0x80 || (c < 0x20 && (c == ISO_CODE_ESC
|| c == ISO_CODE_ESC
|| c == ISO_CODE_SI || c == ISO_CODE_SI
|| c == ISO_CODE_SO))) || c == ISO_CODE_SO)))
break; break;
@ -6878,8 +6874,7 @@ detect_coding_system (src, src_chars, src_bytes, highest, multibytep,
for (i = 0; src < src_end; i++, src++) for (i = 0; src < src_end; i++, src++)
{ {
c = *src; c = *src;
if (c & 0x80 || (c < 0x20 && (c == 0 if (c & 0x80 || (c < 0x20 && (c == ISO_CODE_ESC
|| c == ISO_CODE_ESC
|| c == ISO_CODE_SI || c == ISO_CODE_SI
|| c == ISO_CODE_SO))) || c == ISO_CODE_SO)))
break; break;