From: SourceForge.net <no...@so...> - 2004-09-24 09:43:13
|
Bugs item #1030849, was opened at 2004-09-20 08:55 Message generated for change (Comment added) made by dannysmith You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1030849&group_id=2435 Category: gcc Group: Feature requests >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Gabriel Linder (mingwlinder) Assigned to: Danny Smith (dannysmith) Summary: Characters broken for Unicode Initial Comment: Windows XP SP2 gcc version 3.4.1 ld version 2.15.91 20040904 mingw-runtime 3.5 w32api 3.1 Compiling the code below return this error : main.c:23:1: converting to execution character set: Illegal byte sequence. Replacing the '°' with a space ' ' works fine, but I need some characters like this '°'... And the same code compile fine on Visual C++ 7.1.3088 ! // begin sample code #define UNICODE #define _UNICODE #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <commctrl.h> #include <shellapi.h> int main(void) { LPTSTR lpCmdLine = GetCommandLine(); TCHAR pom[MAX_PATH]; wsprintf(pom, TEXT("Arguments: [%s]"), lpCmdLine); MessageBox(NULL, pom, TEXT("Information"), MB_ICONINFORMATION | MB_OK); INT argc; LPTSTR* argv = CommandLineToArgvW(lpCmdLine, &argc); INT i = 0; while (i < argc) { wsprintf(pom, TEXT("Argument n°%i: [%s]"), i, argv[i]); MessageBox(NULL, pom, TEXT("Information"), MB_ICONINFORMATION | MB_OK); ++i; } return 0; } // end sample code ---------------------------------------------------------------------- >Comment By: Danny Smith (dannysmith) Date: 2004-09-24 21:43 Message: Logged In: YES user_id=11494 ReporterP confirms that bug is fixed with latest RC, so closing Danny ---------------------------------------------------------------------- Comment By: Gabriel Linder (mingwlinder) Date: 2004-09-23 02:22 Message: Logged In: YES user_id=1121203 I have just tried the new GCC 3.4.2 version, and it works fine with -finput-charset=latin1. Many thanks ! ;-) ---------------------------------------------------------------------- Comment By: Gabriel Linder (mingwlinder) Date: 2004-09-21 11:07 Message: Logged In: YES user_id=1121203 All right, I'll wait for 3.4.2 so. But will it be built with libiconv by default, or shall I rebuild it ? ---------------------------------------------------------------------- Comment By: Danny Smith (dannysmith) Date: 2004-09-20 18:26 Message: Logged In: YES user_id=11494 Confirmed. With 3.4.1 one workaround is: INT i = 0; TCHAR degree = 0xb0; while (i < argc) { wsprintf(pom, TEXT("Argument n%c %i: [%s]"), degree, i, argv[i]); MessageBox(NULL, pom, TEXT("Information"), MB_ICONINFORMATION | MB_OK); ++i; } In order to fix properly with current gcc sources is to add dependence on libiconv to allow LATIN1 narrow->wide charset conversion. With 3.4.2 built with libiconv, your testcase works with this command line switch -finput-charset=LATIN1 Danny ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=102435&aid=1030849&group_id=2435 |