diff -urN mc-4.7.5.5.orig/src/viewer/datasource.c mc-4.7.5.5/src/viewer/datasource.c
old
|
new
|
|
164 | 164 | int res = -1; |
165 | 165 | gunichar ch; |
166 | 166 | gchar *next_ch = NULL; |
| 167 | gchar utf8buf[6 + 1]; |
167 | 168 | |
168 | 169 | *char_width = 0; |
169 | 170 | *result = FALSE; |
… |
… |
|
189 | 190 | |
190 | 191 | res = g_utf8_get_char_validated (str, -1); |
191 | 192 | |
| 193 | if (res < 0) |
| 194 | { |
| 195 | /* Retry with explicit bytes to make sure it's not a buffer boundary */ |
| 196 | int i; |
| 197 | for (i = 0; i < 6; i++) |
| 198 | if (mcview_get_byte (view, byte_index + i, &res)) |
| 199 | utf8buf[i] = res; |
| 200 | else |
| 201 | utf8buf[i] = '\0'; |
| 202 | utf8buf[6] = '\0'; |
| 203 | str = utf8buf; |
| 204 | res = g_utf8_get_char_validated (str, -1); |
| 205 | } |
| 206 | |
192 | 207 | if (res < 0) |
193 | 208 | { |
194 | 209 | ch = *str; |