Chinese characters
-
Put them in a text file - use Notepad and save as Unicode (big endian) for ease of reading. Then open the file in VC in binary mode. --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
I must be close but... Using your method (thanks), my hex values are \x62a4\x6797. But I get empty boxes. When I use \x2021, I get the double dagger symbol. My code is basically, ... CFont font1; font1.CreateFont(13,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,0,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|EF_DONTCARE,_T("SimSun") ); Button.SetFont(&font1, TRUE); Button.SetTitle(_L"\x62a4\x6797"); ... What am I missing? Mortie42
-
I must be close but... Using your method (thanks), my hex values are \x62a4\x6797. But I get empty boxes. When I use \x2021, I get the double dagger symbol. My code is basically, ... CFont font1; font1.CreateFont(13,0,0,0,FW_NORMAL,FALSE,FALSE,FALSE,0,OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|EF_DONTCARE,_T("SimSun") ); Button.SetFont(&font1, TRUE); Button.SetTitle(_L"\x62a4\x6797"); ... What am I missing? Mortie42
You need to set the charset parameter correctly. For Chinese, there two -
CHINESEBIG5_CHARSET
andGB2312_CHARSET
. One is simplified, one is traditional, I can never remember which is which. :-> --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ -
You need to set the charset parameter correctly. For Chinese, there two -
CHINESEBIG5_CHARSET
andGB2312_CHARSET
. One is simplified, one is traditional, I can never remember which is which. :-> --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ -
Hmmm. I tried both. I compile w/o warnings But I still get two squares and a dagger with (L"\x62a4\x6797\x2021"); . Any ideas? :confused: Mortie42 -- modified at 17:10 Friday 24th March, 2006
This works for me in a WTL dialog-based app
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CButton btn = GetDlgItem(IDOK);m\_font.CreateFont ( -13, 0, 0, 0, FW\_NORMAL, false, false, false, CHINESEBIG5\_CHARSET, OUT\_DEFAULT\_PRECIS, CLIP\_DEFAULT\_PRECIS, DEFAULT\_QUALITY, DEFAULT\_PITCH|FF\_DONTCARE, \_T("SimSun") ); btn.SetFont ( m\_font ); btn.SetWindowText ( L"\\x62a4\\x6797" );
//...
}The only change I made was the font size and char set params to CreateFont() --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
-
This works for me in a WTL dialog-based app
LRESULT CMainDlg::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
CButton btn = GetDlgItem(IDOK);m\_font.CreateFont ( -13, 0, 0, 0, FW\_NORMAL, false, false, false, CHINESEBIG5\_CHARSET, OUT\_DEFAULT\_PRECIS, CLIP\_DEFAULT\_PRECIS, DEFAULT\_QUALITY, DEFAULT\_PITCH|FF\_DONTCARE, \_T("SimSun") ); btn.SetFont ( m\_font ); btn.SetWindowText ( L"\\x62a4\\x6797" );
//...
}The only change I made was the font size and char set params to CreateFont() --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
I think I have issues else where. I'm using an old copy of VisualC++6.0 on a new WinXP o/s. I copied the DLL's for Chinese; APPWZCHS.DLL AND APPWZCHT.DLL from disc to machine. I tried making a simple MFC dialog application using these. The dialog box in VC showed one set of gibberish while on compilation and execution, the resulting dialog box had rows of ?'s. I'm taking a break for the weekend but before I go, could you tell me which version of VC and o/s you used? Thx for all the help. PS WTL is ...? Mortie42
-
I think I have issues else where. I'm using an old copy of VisualC++6.0 on a new WinXP o/s. I copied the DLL's for Chinese; APPWZCHS.DLL AND APPWZCHT.DLL from disc to machine. I tried making a simple MFC dialog application using these. The dialog box in VC showed one set of gibberish while on compilation and execution, the resulting dialog box had rows of ?'s. I'm taking a break for the weekend but before I go, could you tell me which version of VC and o/s you used? Thx for all the help. PS WTL is ...? Mortie42
I'm using VC 6 on XP SP2. If you're on a fresh XP you probably don't have the east Asian language support installed. Control Panel-Regional and Language options-languages-Install files for east Asian languages. WTL: clickety[^] --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
-
I'm using VC 6 on XP SP2. If you're on a fresh XP you probably don't have the east Asian language support installed. Control Panel-Regional and Language options-languages-Install files for east Asian languages. WTL: clickety[^] --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
Writing strings of Chinese in Hex format, urghh!!! It would be ok for very short items, but damn near impossible to read. I am using VC6, with windowsXP SP1, and the MS MultiLingual User Interface (English and Chinese version installed as one). I have no real problems writing chinese text into my code (without using ascii), or displaying it in the application. One point though, I never build Unicode, I always select MBCS. Try making a simple hello world app with a chinese string and play around with the settings until you get it right. If you have further problems I could give you a simple project to test.
-
I'm using VC 6 on XP SP2. If you're on a fresh XP you probably don't have the east Asian language support installed. Control Panel-Regional and Language options-languages-Install files for east Asian languages. WTL: clickety[^] --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
-
Writing strings of Chinese in Hex format, urghh!!! It would be ok for very short items, but damn near impossible to read. I am using VC6, with windowsXP SP1, and the MS MultiLingual User Interface (English and Chinese version installed as one). I have no real problems writing chinese text into my code (without using ascii), or displaying it in the application. One point though, I never build Unicode, I always select MBCS. Try making a simple hello world app with a chinese string and play around with the settings until you get it right. If you have further problems I could give you a simple project to test.
-
Thx :-D I had assumed that because I could see the Chinese glyphs in Excel, word and Notepad that all was well. Bad me. With the East Asian Languages set the glyphs appear. :) Mortie42
Use the String Table resource, don't put strings in code. My blogs: http://blog.joycode.com/jiangsheng http://blog.csdn.net/jiangsheng http://bloglines.com/public/jiangsheng Command what is yours Conquer what is not ---Kane