diff --git a/src/fl_utf.c b/src/fl_utf.c
index 55eabde..31572c4 100644
--- a/src/fl_utf.c
+++ b/src/fl_utf.c
@@ -130,7 +130,7 @@ static unsigned short cp1252[32] = {
 */
 unsigned fl_utf8decode(const char* p, const char* end, int* len)
 {
-  unsigned char c = *(unsigned char*)p;
+  unsigned char c = *(const unsigned char*)p;
   if (c < 0x80) {
     if (len) *len = 1;
     return c;
@@ -149,17 +149,17 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
       ((p[0] & 0x1f) << 6) +
       ((p[1] & 0x3f));
   } else if (c == 0xe0) {
-    if (((unsigned char*)p)[1] < 0xa0) goto FAIL;
+    if (((const unsigned char*)p)[1] < 0xa0) goto FAIL;
     goto UTF8_3;
 #if STRICT_RFC3629
   } else if (c == 0xed) {
     /* RFC 3629 says surrogate chars are illegal. */
-    if (((unsigned char*)p)[1] >= 0xa0) goto FAIL;
+    if (((const unsigned char*)p)[1] >= 0xa0) goto FAIL;
     goto UTF8_3;
   } else if (c == 0xef) {
     /* 0xfffe and 0xffff are also illegal characters */
-    if (((unsigned char*)p)[1]==0xbf &&
-	((unsigned char*)p)[2]>=0xbe) goto FAIL;
+    if (((const unsigned char*)p)[1]==0xbf &&
+	((const unsigned char*)p)[2]>=0xbe) goto FAIL;
     goto UTF8_3;
 #endif
   } else if (c < 0xf0) {
@@ -171,7 +171,7 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
       ((p[1] & 0x3f) << 6) +
       ((p[2] & 0x3f));
   } else if (c == 0xf0) {
-    if (((unsigned char*)p)[1] < 0x90) goto FAIL;
+    if (((const unsigned char*)p)[1] < 0x90) goto FAIL;
     goto UTF8_4;
   } else if (c < 0xf4) {
   UTF8_4:
@@ -180,8 +180,8 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
 #if STRICT_RFC3629
     /* RFC 3629 says all codes ending in fffe or ffff are illegal: */
     if ((p[1]&0xf)==0xf &&
-	((unsigned char*)p)[2] == 0xbf &&
-	((unsigned char*)p)[3] >= 0xbe) goto FAIL;
+	((const unsigned char*)p)[2] == 0xbf &&
+	((const unsigned char*)p)[3] >= 0xbe) goto FAIL;
 #endif
     return
       ((p[0] & 0x07) << 18) +
@@ -189,7 +189,7 @@ unsigned fl_utf8decode(const char* p, const char* end, int* len)
       ((p[2] & 0x3f) << 6) +
       ((p[3] & 0x3f));
   } else if (c == 0xf4) {
-    if (((unsigned char*)p)[1] > 0x8f) goto FAIL; /* after 0x10ffff */
+    if (((const unsigned char*)p)[1] > 0x8f) goto FAIL; /* after 0x10ffff */
     goto UTF8_4;
   } else {
   FAIL:
@@ -556,7 +556,7 @@ unsigned fl_utf8toa(const char* src, unsigned srclen,
   if (dstlen) for (;;) {
     unsigned char c;
     if (p >= e) {dst[count] = 0; return count;}
-    c = *(unsigned char*)p;
+    c = *(const unsigned char*)p;
     if (c < 0xC2) { /* ascii or bad code */
       dst[count] = c;
       p++;
@@ -704,7 +704,7 @@ unsigned fl_utf8froma(char* dst, unsigned dstlen,
   if (dstlen) for (;;) {
     unsigned char ucs;
     if (p >= e) {dst[count] = 0; return count;}
-    ucs = *(unsigned char*)p++;
+    ucs = *(const unsigned char*)p++;
     if (ucs < 0x80U) {
       dst[count++] = ucs;
       if (count >= dstlen) {dst[count-1] = 0; break;}
@@ -716,7 +716,7 @@ unsigned fl_utf8froma(char* dst, unsigned dstlen,
   }
   /* we filled dst, measure the rest: */
   while (p < e) {
-    unsigned char ucs = *(unsigned char*)p++;
+    unsigned char ucs = *(const unsigned char*)p++;
     if (ucs < 0x80U) {
       count++;
     } else {
diff --git a/src/xutf8/utf8Wrap.c b/src/xutf8/utf8Wrap.c
index d22e38c..89a1680 100644
--- a/src/xutf8/utf8Wrap.c
+++ b/src/xutf8/utf8Wrap.c
@@ -383,7 +383,7 @@ XUtf8DrawRtlString(Display 		*display,
       ptr = buf + 128;
     }
 
-    ulen = XFastConvertUtf8ToUcs((unsigned char*)string, num_bytes, &ucs);
+    ulen = XFastConvertUtf8ToUcs((const unsigned char*)string, num_bytes, &ucs);
 
     if (ulen < 1) ulen = 1;
 
@@ -500,7 +500,7 @@ XUtf8DrawString(Display 	*display,
       i = 0;
     }
 
-    ulen = XFastConvertUtf8ToUcs((unsigned char*)string, num_bytes, &ucs);
+    ulen = XFastConvertUtf8ToUcs((const unsigned char*)string, num_bytes, &ucs);
 
     if (ulen < 1) ulen = 1;
 
@@ -633,7 +633,7 @@ XUtf8_measure_extents(
       i = 0;
     }
 
-    ulen = XFastConvertUtf8ToUcs((unsigned char*)string, num_bytes, &ucs);
+    ulen = XFastConvertUtf8ToUcs((const unsigned char*)string, num_bytes, &ucs);
 
     if (ulen < 1) ulen = 1;
 
@@ -756,7 +756,7 @@ XUtf8TextWidth(XUtf8FontStruct 	*font_set,
       i = 0;
     }
 
-    ulen = XFastConvertUtf8ToUcs((unsigned char*)string, num_bytes, &ucs);
+    ulen = XFastConvertUtf8ToUcs((const unsigned char*)string, num_bytes, &ucs);
 
     if (ulen < 1) ulen = 1;
 
