From c5a0ed7c1aaac56dc96deabba8dd5e7cba261b2d Mon Sep 17 00:00:00 2001 From: Don HO Date: Sat, 20 Jun 2020 22:32:24 +0200 Subject: [PATCH] Fix accented characters not found in "find in files" issues Fix accented characters in ANSI files not found in "find in files" and "replace in files" commands issues. This regression (in v7.7 from v7.6.6) is due to the upgrade of Scintilla from v3.56 to v4.14. Fix #5825, fix #5830, fix #7668, fix #7773 --- PowerEditor/src/Notepad_plus.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 834e61488..41294c908 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -1749,8 +1749,14 @@ bool Notepad_plus::findInFiles() { Buffer * pBuf = MainFileManager.getBufferByID(id); _invisibleEditView.execute(SCI_SETDOCPOINTER, 0, pBuf->getDocument()); - auto cp = _invisibleEditView.execute(SCI_GETCODEPAGE); - _invisibleEditView.execute(SCI_SETCODEPAGE, pBuf->getUnicodeMode() == uni8Bit ? cp : SC_CP_UTF8); + auto detectedCp = _invisibleEditView.execute(SCI_GETCODEPAGE); + int cp2set = SC_CP_UTF8; + if (pBuf->getUnicodeMode() == uni8Bit) + { + cp2set = (detectedCp == SC_CP_UTF8 ? CP_ACP : detectedCp); + } + + _invisibleEditView.execute(SCI_SETCODEPAGE, cp2set); FindersInfo findersInfo; findersInfo._pFileName = fileNames.at(i).c_str(); nbTotal += _findReplaceDlg.processAll(ProcessFindAll, FindReplaceDlg::_env, isEntireDoc, &findersInfo);