Chinese tip display error.
GoogleCodeExporter opened this issue · 10 comments
What steps will reproduce the problem?
1. Chinese tip display error.
2.
3.
What is the expected output? What do you see instead?
same with text in ListCtrl.
What version of the product are you using? On what operating system?
subversion version 276. run on windows 2008.
Please provide any additional information below.
attachment.
Original issue reported on code.google.com by huangyingning@gmail.com
on 8 Apr 2010 at 2:36
Attachments:
Is the application compiled as MultiByte or as Unicode ?
What version of Visual Studio are you using ?
Would it be possible for you to modify the DemoApplication to reproduce this
behavior ? Maybe modify the hardcoded strings in CListCtrl_DataModel.h to
Chinese
(change the file to use unicode) and attach it to this issue.
Original comment by sweaty1
on 8 Apr 2010 at 3:19
> Is the application compiled as MultiByte or as Unicode ?
as MultiByte
> What version of Visual Studio are you using ?
VS2008
> Would it be possible for you to modify the DemoApplication to reproduce this
behavior ? Maybe modify the hardcoded strings in CListCtrl_DataModel.h to
Chinese
(change the file to use unicode) and attach it to this issue.
DemoApplication is ok! see attachment.
Original comment by huangyingning@gmail.com
on 9 Apr 2010 at 10:11
Attachments:
line 1 : BOOL CGridListCtrlEx::OnToolNeedText(UINT id, NMHDR* pNMHDR, LRESULT*
pResult)
{
line 2 : CPoint pt(GetMessagePos());
line 3 : ScreenToClient(&pt);
line 4 : int nRow, nCol;
line 5 : CellHitTest(pt, nRow, nCol);
// Make const-reference to the returned anonymous CString-object,
// will keep it alive until reaching scope end
line 6 : CString tooltip;
line 7 : if (!OnDisplayCellTooltip(nRow, nCol,tooltip) || tooltip.IsEmpty())
line 8 : return FALSE;
// Non-unicode applications can receive requests for tooltip-text in unicode
line 9 : TOOLTIPTEXTA* pTTTA = reinterpret_cast<TOOLTIPTEXTA*>(pNMHDR);
line 10 : TOOLTIPTEXTW* pTTTW = reinterpret_cast<TOOLTIPTEXTW*>(pNMHDR);
#ifndef _UNICODE
line 11 : if (pNMHDR->code == TTN_NEEDTEXTA)
line 12 : lstrcpyn(pTTTA->szText, static_cast<LPCTSTR>(tooltip), sizeof
(pTTTA->szText));
else
#if __STDC_WANT_SECURE_LIB__
line 13 : mbstowcs_s(NULL, pTTTW->szText, static_cast<LPCTSTR>
(tooltip), sizeof(pTTTW->szText)/sizeof(WCHAR));
#else
line 14 : mbstowcs(pTTTW->szText, static_cast<LPCTSTR>(tooltip), sizeof
(pTTTW->szText)/sizeof(WCHAR));
#endif
#else
line 15 : if (pNMHDR->code == TTN_NEEDTEXTA)
line 16 : _wcstombsz(pTTTA->szText, static_cast<LPCTSTR>(tooltip),
sizeof(pTTTA->szText));
else
line 17 : lstrcpyn(pTTTW->szText, static_cast<LPCTSTR>(tooltip), sizeof
(pTTTW->szText)/sizeof(WCHAR));
#endif
line 18 : return TRUE;
}
compiled as MultiByte, I try to debug it, after line 13, pTTTW->szText to be
unrecongnizable code.
Original comment by huangyingning@gmail.com
on 9 Apr 2010 at 11:09
VS2008 "Debug MultiByte" test project.
Original comment by huangyingning@gmail.com
on 9 Apr 2010 at 11:17
Attachments:
If you want me to look at it, then you need to create a reproducable case for
me.
Seems you should look at what you are doing different than the
demo-application. I
can see that some one else had a similar problem as you, but never found a
solution:
http://www.codeproject.com/Messages/3352682/A-Problem-about-unrecongnizable-code
.aspx
Original comment by sweaty1
on 9 Apr 2010 at 10:35
Thanks a lot!
Original comment by huangyingning@gmail.com
on 9 Apr 2010 at 11:18
I just loaded the demo project you have attached, and both texts are displayed
just
fine.
But I see that you have forgot to change the encoding of the
CListCtrl_DataModel.h
to Unicode. When in Ansi format, then the Chinese characters are lost when used
on
my computer.
I don't think I will able to give you much help in this matter as I don't have
much
experience with multibyte and chinese codepages. Maybe these pages can help you:
http://wyw.dcweb.cn/multibyte.htm
http://publib.boulder.ibm.com/infocenter/iadthelp/v7r0/index.jsp?
topic=/com.ibm.etools.iseries.langref.doc/rzan5mst167.htm
Original comment by sweaty1
on 9 Apr 2010 at 9:00
but CListCtrl_DataModel.h can not convert to unicode.
Thanks a lot!
Original comment by huangyingning@gmail.com
on 10 Apr 2010 at 2:04
You still need to provide a reproducable case, if you want me to look at
something.
My guess is that when running in multibyte mode, then you have multiple Chinese
codepages/locations you can switch between. And you need to use the one
matching the
Chinese characters you want to display. You might want to consult a Chinese
development forum, since they probably have much more experience in this area
than I
do.
I guess an easier solution is changing your application to Unicode.
Original comment by sweaty1
on 11 Apr 2010 at 2:18
Closing the issue, since it is not possible for me to reproduce the issue.
Original comment by sweaty1
on 21 Jun 2010 at 9:11
- Changed state: Invalid