changeset 89780:a53cb5864a40

(detect_coding_iso_2022): Fix handling of SS2 and SS3. (detect_coding): Treat '\0' as normal ASCII byte.. (detect_coding_system): Likewise.
author Kenichi Handa <handa@m17n.org>
date Thu, 29 Jan 2004 01:25:50 +0000
parents 74c503490829
children 71b7464faec1
files src/coding.c
diffstat 1 files changed, 8 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Wed Jan 28 11:03:31 2004 +0000
+++ b/src/coding.c	Thu Jan 29 01:25:50 2004 +0000
@@ -2616,20 +2616,21 @@
 	  found |= CATEGORY_MASK_ISO_8_ELSE;
 	  goto check_extra_latin;
 
-
 	case ISO_CODE_SS2:
 	case ISO_CODE_SS3:
 	  /* Single shift.   */
 	  if (inhibit_iso_escape_detection)
 	    break;
-	  single_shifting = 1;
+	  single_shifting = 0;
 	  rejected |= CATEGORY_MASK_ISO_7BIT;
 	  if (CODING_ISO_FLAGS (&coding_categories[coding_category_iso_8_1])
 	      & 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])
 	      & 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;
 
 	default:
@@ -2680,11 +2681,7 @@
 	    found |= CATEGORY_MASK_ISO_8_1;
 	  else
 	    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;
 	}
     }
   detect_info->rejected |= CATEGORY_MASK_ISO;
@@ -5349,8 +5346,7 @@
       for (i = 0, src = coding->source; src < src_end; i++, src++)
 	{
 	  c = *src;
-	  if (c & 0x80 || (c < 0x20 && (c == 0
-					|| c == ISO_CODE_ESC
+	  if (c & 0x80 || (c < 0x20 && (c == ISO_CODE_ESC
 					|| c == ISO_CODE_SI
 					|| c == ISO_CODE_SO)))
 	    break;
@@ -6878,8 +6874,7 @@
       for (i = 0; src < src_end; i++, src++)
 	{
 	  c = *src;
-	  if (c & 0x80 || (c < 0x20 && (c == 0
-					|| c == ISO_CODE_ESC
+	  if (c & 0x80 || (c < 0x20 && (c == ISO_CODE_ESC
 					|| c == ISO_CODE_SI
 					|| c == ISO_CODE_SO)))
 	    break;