diff --git a/c/iso2022 b/c/iso2022
index 78f75d7b1f0399ae266c68e28ca0e7aa057104fd..feced35e16bfb33b62b47296b8a26444be5adc8b 100644
--- a/c/iso2022
+++ b/c/iso2022
@@ -44,7 +44,7 @@ struct ISO2022_EncoderSet
 {
     encoding_table table;
 
-    const char *esc_seq;
+    const unsigned char *esc_seq;
     int esc_seq_len;
 };
 
@@ -54,30 +54,30 @@ struct ISO2022_Encoding
     ISO2022_Set *Set[4+2];
 
     ISO2022_Set *CL, *GL, *CR, *GR;
-    char CL_s, GL_s, CR_s, GR_s;
+    unsigned char CL_s, GL_s, CR_s, GR_s;
 
-    char ssarea;
+    unsigned char ssarea;
 
-    char sync[2];
+    unsigned char sync[2];
 
-    char tempset;
+    unsigned char tempset;
     ISO2022_Set *oldset;
 
-    char esc_disabled;
+    unsigned char esc_disabled;
 
     /* Pending escape commands */
-    char esc_pending;
-    char esc_multi;
-    char esc_inter1;
-    char esc_inter2;
-    char esc_inter3;
-    char esc_revision;
+    unsigned char esc_pending;
+    unsigned char esc_multi;
+    unsigned char esc_inter1;
+    unsigned char esc_inter2;
+    unsigned char esc_inter3;
+    unsigned char esc_revision;
 
     /* encoding tables - 10 pointers should do for now */
     ISO2022_EncoderSet table[MAX_TABLES];
     int current[4];
-    char first;
-    char oneoffdesignator;
+    unsigned char first;
+    unsigned char oneoffdesignator;
 };
 
 #define iso2022_ws_size (sizeof(ISO2022_Encoding) - sizeof(EncodingPriv))
@@ -86,7 +86,7 @@ struct ISO2022_Encoding
 
 struct ISO2022_Set
 {
-    UCS4 (*next_code)(struct ISO2022_Set *s, int c, int invoker, char *sync);
+    UCS4 (*next_code)(struct ISO2022_Set *s, int c, int invoker, unsigned char *sync);
 };
 
 #define G0 0
@@ -121,12 +121,12 @@ typedef struct simple_set
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static UCS4 iso2022_esc_cont(ISO2022_Encoding *i, char c);
+static UCS4 iso2022_esc_cont(ISO2022_Encoding *i, unsigned char c);
 static void iso2022_esc(ISO2022_Encoding *i);
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static UCS4 simple_double_next_code_94(ISO2022_Set *s, int c, int invoker, char *sync)
+static UCS4 simple_double_next_code_94(ISO2022_Set *s, int c, int invoker, unsigned char *sync)
 {
     simple_set *ss = (simple_set *) s;
 
@@ -151,7 +151,7 @@ static UCS4 simple_double_next_code_94(ISO2022_Set *s, int c, int invoker, char
     NOT_USED(invoker);
 }
 
-static UCS4 null_double_next_code(ISO2022_Set *s, int c, int invoker, char *sync)
+static UCS4 null_double_next_code(ISO2022_Set *s, int c, int invoker, unsigned char *sync)
 {
     return 0xFFFD;
 
@@ -161,7 +161,7 @@ static UCS4 null_double_next_code(ISO2022_Set *s, int c, int invoker, char *sync
     NOT_USED(sync);
 }
 
-static UCS4 simple_next_code_94(ISO2022_Set *s, int c, int invoker, char *sync)
+static UCS4 simple_next_code_94(ISO2022_Set *s, int c, int invoker, unsigned char *sync)
 {
     if (c > 0 && c < 0x5F)
         return encoding_table_ptr(((simple_set *)s)->table)[c-1]; /* -1 for 94 byte tables */
@@ -174,7 +174,7 @@ static UCS4 simple_next_code_94(ISO2022_Set *s, int c, int invoker, char *sync)
     NOT_USED(sync);
 }
 
-static UCS4 simple_next_code_96(ISO2022_Set *s, int c, int invoker, char *sync)
+static UCS4 simple_next_code_96(ISO2022_Set *s, int c, int invoker, unsigned char *sync)
 {
     return encoding_table_ptr(((simple_set *)s)->table)[c];
 
@@ -182,7 +182,7 @@ static UCS4 simple_next_code_96(ISO2022_Set *s, int c, int invoker, char *sync)
     NOT_USED(sync);
 }
 
-static UCS4 null_next_code_94(ISO2022_Set *s, int c, int invoker, char *sync)
+static UCS4 null_next_code_94(ISO2022_Set *s, int c, int invoker, unsigned char *sync)
 {
     if (invoker == _GL)
     {
@@ -196,7 +196,7 @@ static UCS4 null_next_code_94(ISO2022_Set *s, int c, int invoker, char *sync)
     NOT_USED(sync);
 }
 
-static UCS4 null_next_code_96(ISO2022_Set *s, int c, int invoker, char *sync)
+static UCS4 null_next_code_96(ISO2022_Set *s, int c, int invoker, unsigned char *sync)
 {
     return 0xFFFD;
 
@@ -396,17 +396,17 @@ static int iso2022_reset(Encoding *e, int for_encoding)
     if (e->list_entry->preload)
     {
 	unsigned int n = strlen(e->list_entry->preload);
-	if (n != e->read(e, NULL, e->list_entry->preload, n, NULL))
+	if (n != e->read(e, NULL, (unsigned char *)e->list_entry->preload, n, NULL))
 	    return 0;
     }
 
     if (for_encoding != encoding_READ)
     {
-	const char *s = e->list_entry->encoder_data;
+	const unsigned char *s = (const unsigned char *)e->list_entry->encoder_data;
 	if (s)
 	{
 	    int tab = 0;
-	    const char *last_s = NULL;
+	    const unsigned char *last_s = NULL;
 
 	    /* free up the old ones before allocating new ones */
 	    iso2022_free_write_tables(i);
@@ -414,7 +414,7 @@ static int iso2022_reset(Encoding *e, int for_encoding)
 	    /* process the table specifying string, they will all place into G1 */
 	    while (tab < MAX_TABLES)
 	    {
-		int c = *s;
+		unsigned char c = *s;
 
 		if (c == 0 || c == 0x1B)
 		{
@@ -444,7 +444,8 @@ static int iso2022_reset(Encoding *e, int for_encoding)
 		else
 		{
 		    /* Jiggery pokery - run all through G1 just for this scan */
-		    iso2022_esc_cont(i, c >= 0x28 && c <= 0x2F ? (c&~3)+1 : c);
+		    iso2022_esc_cont(i,(unsigned char )(c >= 0x28 && c <= 0x2F ?
+                                                        (c&~3)+1 : c));
 
 		    /* Aaargh! Above won't work for crummy 1B 24 42 Japanese broken sequences */
 		    if (c == 0x24 && s[1] >= 0x40) iso2022_esc_cont(i, 0x29);
@@ -489,7 +490,7 @@ static void iso2022_esc(ISO2022_Encoding *i)
     i->esc_inter3 = 0;
 }
 
-static UCS4 iso2022_esc_cont(ISO2022_Encoding *i, char c)
+static UCS4 iso2022_esc_cont(ISO2022_Encoding *i, unsigned char c)
 {
     if (c >= 0x7F || c < 0x20)
     {
@@ -576,7 +577,7 @@ static UCS4 iso2022_esc_cont(ISO2022_Encoding *i, char c)
 
 static unsigned int iso2022_read(EncodingPriv *e,
 			  encoding_read_callback_fn ucs_out,
-                          const char *s,
+                          const unsigned char *s,
                           unsigned int n,
                           void *handle)
 {
@@ -585,7 +586,7 @@ static unsigned int iso2022_read(EncodingPriv *e,
 
     for (count = n; count; count--)
     {
-        char c = *s++;
+        unsigned char c = *s++;
         UCS4 u;
 
 	UNIDBG(("iso2022: %02x\n", c));
@@ -660,7 +661,7 @@ static unsigned int iso2022_read(EncodingPriv *e,
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static int write_index(int index, char *out, int table_size, int sevenbit)
+static int write_index(int index, unsigned char *out, int table_size, int sevenbit)
 {
     int base = sevenbit ? 0x20 : 0xA0;
     switch (table_size)
@@ -717,11 +718,11 @@ static int iso2022_scan_tables(ISO2022_Encoding *enc, UCS4 u, int *index, int *t
  * to switch between them.
  */
 
-static int iso2022_write_shifts(EncodingPriv *e, UCS4 u, char **ps, int *bufsize)
+static int iso2022_write_shifts(EncodingPriv *e, UCS4 u, unsigned char **ps, int *bufsize)
 {
     ISO2022_Encoding *enc = (ISO2022_Encoding *)e;
     int index, tab, n_entries;
-    char buf[16];		/* assume that 16 characters will be enough space */
+    unsigned char buf[16];		/* assume that 16 characters will be enough space */
     int out = 0;
     int GL_s = enc->GL_s;
     int current[4];
@@ -880,10 +881,10 @@ static int iso2022_scan_sets(ISO2022_Encoding *enc, UCS4 u, int *index, int *tab
  * 8859-X: sets 0 and 1 are fixed, sets 2 and 3 aren't used.
  */
 
-static int iso2022_write_euc(EncodingPriv *e, UCS4 u, char **euc, int *bufsize)
+static int iso2022_write_euc(EncodingPriv *e, UCS4 u, unsigned char **euc, int *bufsize)
 {
     ISO2022_Encoding *enc = (ISO2022_Encoding *)e;
-    char buf[4];
+    unsigned char buf[4];
 
     int index, set, n_entries;
     int out = 0;