| Summary: | can't support MultiByte characters(Chinese) | ||
|---|---|---|---|
| Product: | SDL | Reporter: | everywherewind |
| Component: | *don't know* | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED ENDOFLIFE | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 1.2.12 | ||
| Hardware: | x86 | ||
| OS: | Windows (All) | ||
Unicode support in SDL 1.2 is buggy, and can't be fixed properly without breaking the API. We have done this for SDL 2.0, though, so it will be better there. --ryan. (In reply to comment #1) > Unicode support in SDL 1.2 is buggy, and can't be fixed properly without > breaking the API. > > We have done this for SDL 2.0, though, so it will be better there. > > --ryan. Thank you.look forward to the official release of sdl 2.0 Hello, and sorry if you're getting several copies of this message by email, since we are closing many bugs at once here. We have decided to mark all SDL 1.2-related bugs as RESOLVED ENDOFLIFE, as we don't intend to work on SDL 1.2 any further, but didn't want to mark a large quantity of bugs as RESOLVED WONTFIX, to clearly show what was left unattended to and make it easily searchable. Our current focus is on SDL 2.0. If you are still having problems with an ENDOFLIFE bug, your absolute best option is to move your program to SDL2, as it will likely fix the problem by default, and give you access to modern platforms and tons of super-cool new features. Failing that, we _will_ accept small patches to fix these issues, and put them in revision control, although we do not intend to do any further official 1.2 releases. Failing that, please feel free to contact me directly by email (icculus@icculus.org) and we'll try to find some way to help you out of your situation. Thank you, --ryan. |
I'm from China and I play an open source game named the Battle of Wesnoth.The game uses SDL.There is a problem troubling we Chinese players for long time,(maybe since 2007) We cannot input Chinese characters in the dialog box on Windows system.A friend named dm2 who knows something about coding found a method to solve the problem. He said,wesnoth supports unicode,and the bug is in SDL.The lib has bugs with inputing multibyte characters,at least on Windows. then he gave the method.first download SDL's source code, then open the file SDL_dibevents.c under floder windib,find the function DIB_HandleMessage , LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_SYSKEYDOWN: case WM_KEYDOWN: { SDL_keysym keysym;...... then chage to: LRESULT DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_IME_CHAR:{ SDL_keysym keysym; char mtcs[2]; mtcs[0] = HIBYTE(LOWORD(wParam)); mtcs[1] = LOBYTE(LOWORD(wParam)); keysym.scancode = (unsigned char)HIWORD(lParam); keysym.mod = KMOD_NONE; keysym.sym = 0; MultiByteToWideChar( CP_ACP,0,mtcs,2,&keysym.unicode,sizeof(keysym.unicode) ); posted = SDL_PrivateKeyboard(SDL_PRESSED,&keysym); } return 0; case WM_SYSKEYDOWN: case WM_KEYDOWN: { SDL_keysym keysym; note what new added,in fact to achieve WM_IME_CHAR message.Change multicharacters from IME to unicode by using MultiByteToWideChar,then send to Wesnoth. and find function DIB_PumpEvents in the file as well: void DIB_PumpEvents(_THIS) { MSG msg; while ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) { if ( GetMessage(&msg, NULL, 0, 0) > 0 ) { DispatchMessage(&msg); } } } add line TranslateMessage( &msg ); like void DIB_PumpEvents(_THIS) { MSG msg; while ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) { if ( GetMessage(&msg, NULL, 0, 0) > 0 ) { TranslateMessage( &msg ); DispatchMessage(&msg); } } } Because if we don't add TranslateMessage into the message loop,Windows won't convert WM_KEYDOWN and WM_KEYUP to WM_CHAR and WM_IME_CHAR. finally rebuild SDL.dll and replace the file in wesnoth floder. Wesnoth has released many new versions,but still has the problem.if I replace SDL.dll and input Chinese characters ,the ones who do not know how to do will receive Garbled. So we hope the SDL officer will solve the problem in official release.