Re: CListCtrl unicode doesn't display korean characters correctly
// ListCtrl Font
CFont *ListFont = m_List.GetFont();
if(ListFont)
{
LOGFONT LogFont;
ListFont->GetLogFont(&LogFont);
lstrcpy(LogFont.lfFaceName, _T("Arial Unicode MS"));
if(!_ListCtrlFont.CreateFontIndirect(&LogFont)) {
lstrcpy(LogFont.lfFaceName, _T("Arial"));
_ListCtrlFont.CreateFontIndirect(&LogFont);
}
m_List.SetFont(&_ListCtrlFont);
Ok, here it is: *not a Windows bug*
Try adding this after GetLogFont but before CreateFontIndirect:
LogFont.lfCharSet = DEFAULT_CHARSET;
GetLogFont returns the original list's font. That selected when the list is
created, and it is 0 (ANSI_CHARSET).
But you are trying to show characters outside the ANSI code page.
See the "DEFAULT_CHARSET in LOGFONT" section in
http://www.microsoft.com/globaldev/getwr/steps/wrg_font.mspx
<quote>
DEFAULT_CHARSET is not a real charset; in reality on Windows 2000 and Windows
XP it does two things:
- It tries to select the named font with the current system character set.
- If the named font exists but does not support the system character set, it
will still select the font with a charset that the font does support.
!!!
DEFAULT_CHARSET should be used when displaying a string of characters encoded
with Unicode.
!!!
</quote>
--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email