aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenichi Handa <[email protected]>2003-05-28 23:27:28 +0000
committerKenichi Handa <[email protected]>2003-05-28 23:27:28 +0000
commit103e0180b37bc7df82a0c31be14c50f6758d1bf7 (patch)
tree88c79b0e0c0fcd0fc0072d7b02c6ac2828629e26
parent75a756f1471f181a1226f05eeea50a206eae5a70 (diff)
*** empty log message ***
-rw-r--r--src/ChangeLog23
-rw-r--r--src/coding.c72
2 files changed, 95 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a231582d67..b2e91effc1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,26 @@
+2003-05-29 Kenichi Handa <[email protected]>
+
+ * coding.c (decode_coding_iso2022): Pay attention to the byte
+ sequence of CTEXT extended segment, and retain those bytes as is.
+
+2003-05-28 Kenichi Handa <[email protected]>
+
+ * coding.c (ENCODE_UNSAFE_CHARACTER): Adjusted for the name change
+ of CODING_REPLACEMENT_CHARACTER.
+ (decode_coding_iso2022): If CODING_FLAG_ISO_SAFE, set
+ CODING_MODE_INHIBIT_UNENCODABLE_CHAR flag in coding->mode, and
+ check this flag on encoding.
+ (encode_coding_sjis_big5): Check
+ CODING_MODE_INHIBIT_UNENCODABLE_CHAR flag of coding->mode.
+ (Fset_terminal_coding_system_internal): Set
+ CODING_MODE_INHIBIT_UNENCODABLE_CHAR flag in terminal_coding.mode
+ instead of setting CODING_FLAG_ISO_SAFE flag in
+ terminal_coding.flags.
+
+ * coding.h (CODING_REPLACEMENT_CHARACTER): Renamed from
+ CODING_INHIBIT_CHARACTER_SUBSTITUTION.
+ (CODING_MODE_INHIBIT_UNENCODABLE_CHAR): New macro.
+
2003-05-28 Richard M. Stallman <[email protected]>
* print.c (syms_of_print) <print-escape-nonascii>: Doc fix.
diff --git a/src/coding.c b/src/coding.c
index e329a22817..570715a244 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -2036,6 +2036,78 @@ decode_coding_iso2022 (coding, source, destination, src_bytes, dst_bytes)
}
continue;
+ case '%':
+ if (COMPOSING_P (coding))
+ DECODE_COMPOSITION_END ('1');
+ ONE_MORE_BYTE (c1);
+ if (c1 == '/')
+ {
+ /* CTEXT extended segment:
+ ESC % / [0-4] M L --ENCODING-NAME-- \002 --BYTES--
+ We keep these bytes as is for the moment.
+ They may be decoded by post-read-conversion. */
+ int dim, M, L;
+ int size, required;
+ int produced_chars;
+
+ ONE_MORE_BYTE (dim);
+ ONE_MORE_BYTE (M);
+ ONE_MORE_BYTE (L);
+ size = ((M - 128) * 128) + (L - 128);
+ required = 8 + size * 2;
+ if (dst + required > (dst_bytes ? dst_end : src))
+ goto label_end_of_loop;
+ *dst++ = ISO_CODE_ESC;
+ *dst++ = '%';
+ *dst++ = '/';
+ *dst++ = dim;
+ produced_chars = 4;
+ dst += CHAR_STRING (M, dst), produced_chars++;
+ dst += CHAR_STRING (L, dst), produced_chars++;
+ while (size-- > 0)
+ {
+ ONE_MORE_BYTE (c1);
+ dst += CHAR_STRING (c1, dst), produced_chars++;
+ }
+ coding->produced_char += produced_chars;
+ }
+ else if (c1 == 'G')
+ {
+ unsigned char *d = dst;
+ int produced_chars;
+
+ /* XFree86 extension for embedding UTF-8 in CTEXT:
+ ESC % G --UTF-8-BYTES-- ESC % @
+ We keep these bytes as is for the moment.
+ They may be decoded by post-read-conversion. */
+ if (d + 6 > (dst_bytes ? dst_end : src))
+ goto label_end_of_loop;
+ *d++ = ISO_CODE_ESC;
+ *d++ = '%';
+ *d++ = 'G';
+ produced_chars = 3;
+ while (d + 1 < (dst_bytes ? dst_end : src))
+ {
+ ONE_MORE_BYTE (c1);
+ if (c1 == ISO_CODE_ESC
+ && src + 1 < src_end
+ && src[0] == '%'
+ && src[1] == '@')
+ break;
+ d += CHAR_STRING (c1, d), produced_chars++;
+ }
+ if (d + 3 > (dst_bytes ? dst_end : src))
+ goto label_end_of_loop;
+ *d++ = ISO_CODE_ESC;
+ *d++ = '%';
+ *d++ = '@';
+ dst = d;
+ coding->produced_char += produced_chars + 3;
+ }
+ else
+ goto label_invalid_code;
+ continue;
+
default:
if (! (coding->flags & CODING_FLAG_ISO_DESIGNATION))
goto label_invalid_code;