diff --git a/src/viewer/ascii.c b/src/viewer/ascii.c
index 623cd9a3b..2e23db076 100644
a
|
b
|
mcview_char_display (const WView * view, int c, char *s) |
341 | 341 | * Normally: stores c, updates state, returns TRUE. |
342 | 342 | * At EOF: state is unchanged, c is undefined, returns FALSE. |
343 | 343 | * |
| 344 | * Just as with mcview_get_utf(), invalid UTF-8 is reported using negative integers. |
| 345 | * |
344 | 346 | * Also, temporary hack: handle force_max here. |
345 | 347 | * TODO: move it to lower layers (datasource.c)? |
346 | 348 | */ |
diff --git a/src/viewer/datasource.c b/src/viewer/datasource.c
index c90caf32e..94e6f06f0 100644
a
|
b
|
mcview_get_ptr_file (WView * view, off_t byte_index) |
147 | 147 | |
148 | 148 | /* --------------------------------------------------------------------------------------------- */ |
149 | 149 | |
| 150 | /* Invalid UTF-8 is reported as negative integers (one for each byte), |
| 151 | * see ticket 3783. */ |
150 | 152 | gboolean |
151 | 153 | mcview_get_utf (WView * view, off_t byte_index, int *ch, int *ch_len) |
152 | 154 | { |
… |
… |
mcview_get_utf (WView * view, off_t byte_index, int *ch, int *ch_len) |
200 | 202 | |
201 | 203 | if (res < 0) |
202 | 204 | { |
203 | | *ch = (unsigned char) (*str); |
| 205 | /* Implicit conversion from signed char to signed int keeps negative values. */ |
| 206 | *ch = *str; |
204 | 207 | *ch_len = 1; |
205 | 208 | } |
206 | 209 | else |