From 5ee452eba93755bc7c2d0fb1e4226e8a2c56d64b Mon Sep 17 00:00:00 2001 From: "Yury V. Zaytsev" Date: Sat, 9 Sep 2017 08:46:40 +0200 Subject: [PATCH] Ticket #3843: mcedit - fix broken encoding into UTF-8 for 8-bit displays MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reported-by: LĹ‘rinczy Zsigmond Reviewed-by: Egmont Koblinger Signed-off-by: Yury V. Zaytsev --- src/editor/edit.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/editor/edit.c b/src/editor/edit.c index eaab3c4d9..f79f65e17 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -3356,7 +3356,12 @@ edit_execute_cmd (WEdit * edit, long command, int char_for_insertion) if (option_cursor_beyond_eol && edit->over_col > 0) edit_insert_over (edit); #ifdef HAVE_CHARSET - if (char_for_insertion > 255 && !mc_global.utf8_display) + /** + Encode 8-bit input as UTF-8, if display (locale) is *not* UTF-8, + *but* source encoding *is* set to UTF-8; see ticket #3843 for the details. + */ + if (char_for_insertion > 127 && str_isutf8 (get_codepage_id (mc_global.source_codepage)) + && !mc_global.utf8_display) { unsigned char str[UTF8_CHAR_LEN + 1]; size_t i = 0; -- 2.11.4.GIT