Using Scintilla 5.5.6/7 with DirectWrite enabled, autocompletion lists can display illegible text if both:
the host PC's ANSI code page is a DBCS encoding, and;
completion candidates are sourced from a document in the same DBCS encoding as the ACP.
It seems the popup list's character set remains in the singe-byte default setting (influenced by the document's ACP encoding 🤔?), rather than a character set appropriate for the active SC_TECHNOLOGY_* setting.
Putting the parent Scintilla window into GDI mode resolves the issue.
Dynamically changing the popup's character set based on the document's encoding also appears to be effective.
reg query HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage /v ACP
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage
ACP REG_SZ 936
with open('sample.txt', 'wb') as f:
f.write(bytes('zh-中文', '936'))
code.page=936
character.set=132
technology=1
autocompleteword.automatic=1
wscite.exe and trigger the autocompletion list:
Cross-posted from https://github.com/notepad-plus-plus/notepad-plus-plus/issues/16719
A possible fix is directly passing code page (instead of Unicode mode) to list box, but this maybe a broken change on platform interface.
Or
ListOptionscould be extended to addcodePageproperty likeSurfaceMode.May be worthwhile although the ordering (
SetOptionsis called beforeCreatewhich has to be maintained for compatibility) should be considered inListBoxX::Create.This patch to Scintilla fixes Notepad++ in some circumstances although I don't really understand how it is determining code pages and character sets so may not handle other cases. The patch is also OK in SciTE.
It works the same way as
EditModel::CurrentSurfaceMode()forEditor::CreateDrawingSurface(), code page 0 is CP_ACP.unicodeModefiled and parameter can be removed.A
SurfaceModecould be added toListOptionsbut that would imply thatbidiR2Lmay be implemented which looks unlikely due to lack of interest in bidirectional work.SurfaceModemay grow more complex.If
CodePageTransfer.patchis committed, there are various pieces of dead code that could be trimmed (FontWin::GetCharacterSet...) .Code page 936 is GB 2312 but that doesn't match character set 132.
GB2312_CHARSETfrom WinGDI.h (and thusSC_CHARSET_GB2312) is 134.When the property is corrected to

character.set=134I see:So, yes, the issue comes entirely from a misconfigured character set, not
technologyafter all. There must be a downstream reason why the char sets mismatch when N++ has D2D enabled.. Thanks anyway for looking at it.