diff src/charset.h @ 4096:1abf84db2c7f

[xemacs-hg @ 2007-08-04 20:00:10 by aidan] Preserve invalid UTF-8, UTF-16 sequences on encoding, decoding.
author aidan
date Sat, 04 Aug 2007 20:00:24 +0000
parents 3ef0aaf3dc34
children d7cc9553d3eb e0db3c197671
line wrap: on
line diff
--- a/src/charset.h	Fri Aug 03 21:51:12 2007 +0000
+++ b/src/charset.h	Sat Aug 04 20:00:24 2007 +0000
@@ -567,12 +567,20 @@
   UNICODE_UTF_16,
   UNICODE_UTF_8,
   UNICODE_UTF_7,
-  UNICODE_UCS_4
+  UNICODE_UCS_4,
+  UNICODE_UTF_32
 };
 
 void encode_unicode_char (Lisp_Object USED_IF_MULE (charset), int h,
 			  int USED_IF_MULE (l), unsigned_char_dynarr *dst,
-			  enum unicode_type type, unsigned int little_endian);
+			  enum unicode_type type, unsigned int little_endian,
+                          int write_error_characters_as_such);
+
+#define UNICODE_ERROR_OCTET_RANGE_START 0x200000
+
+#define valid_utf_16_first_surrogate(ch) (((ch) & 0xFC00) == 0xD800)
+#define valid_utf_16_last_surrogate(ch) (((ch) & 0xFC00) == 0xDC00)
+#define valid_utf_16_surrogate(ch) (((ch) & 0xF800) == 0xD800)
 
 void set_charset_registries(Lisp_Object charset, Lisp_Object registries);