6b7b5c7
--- mc-2006-08-12-18/edit/editdraw.c.8bit-hex	2006-09-05 14:35:21.000000000 +0200
6b7b5c7
+++ mc-2006-08-12-18/edit/editdraw.c	2006-09-05 14:35:21.000000000 +0200
6b7b5c7
@@ -70,12 +70,22 @@
6b7b5c7
      */
6b7b5c7
     if (edit->curs1 < edit->last_byte) {
6b7b5c7
         mc_wchar_t cur_byte = edit_get_byte (edit, edit->curs1);
6b7b5c7
+        mc_wchar_t cur_byte2 = cur_byte;
6b7b5c7
 #ifndef UTF8
6b7b5c7
 	g_snprintf (byte_str, sizeof (byte_str), "%c %3d 0x%02X",
6b7b5c7
 		    is_printable (cur_byte) ? cur_byte : '.',
6b7b5c7
 #else /* UTF8 */
6b7b5c7
+        /* In 8-bit locales show the byte itself instead of its Unicode value */
6b7b5c7
+        if (MB_CUR_MAX == 1) {
6b7b5c7
+            unsigned char cur_8bit_byte;
6b7b5c7
+            mbstate_t mbs;
6b7b5c7
+            memset (&mbs, 0, sizeof (mbs));
6b7b5c7
+            if (wcrtomb(&cur_8bit_byte, cur_byte, &mbs) == 1) {
6b7b5c7
+                cur_byte = cur_8bit_byte;
6b7b5c7
+            }
6b7b5c7
+        }
6b7b5c7
         g_snprintf (byte_str, sizeof(byte_str), "%lc %3d 0x%02X",
6b7b5c7
-                    iswprint(cur_byte) ? cur_byte : '.',
6b7b5c7
+                    iswprint(cur_byte2) ? cur_byte2 : '.',
6b7b5c7
 #endif /* UTF8 */
6b7b5c7
                     (int) cur_byte,
6b7b5c7
                     (unsigned) cur_byte);