Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: Arhon on May 26, 2008, 09:11:12 pm
-
wchar_t ws[] = L"english language"; // its OK
wchar_t ws[] = L"other language"; // compile error - converting to execution character set: Illegal byte sequence|
as be? what to do?
my code page cp1251 (russian) Windows Vista
Code::Blocks 8.02, settings default
-
as be? what to do?
Nice to know about OS, compiler, version... etc... probably steps to reproduce / sample project... What's the relation to C::B? We won't just solve compiler errors here. Currently you don't provide enough information!
-
Hi,
I am not sure about your problem, but I use "-finput-charset=latin5" to get rid of this error. You may use a similar "-finput-charset=cyrillic" in "Compiler Settings/Other Options". I hope this helps.
Regards,
Ramazan Kartal
-
Thank you, Ramazan Kartal.
-finput-charset=windows-1251 - good
As be if using several language in code ?.
For MortenMacFly.
// main.c
#define UNICODE
#include <windows.h>
//---------------------------------------------------------------------------
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
wchar_t capt[] = L"Sample text";
wchar_t text_en[] = L"Hello";
wchar_t text_ru[] = L"Привет"; // (russian string) error - converting to execution character set: Illegal byte sequence
MessageBoxExW(NULL, text_en, capt, MB_OK, 0);
MessageBoxExW(NULL, text_ru, capt, MB_OK, 0);
return 0;
}
//---------------------------------------------------------------------------
/*
OS - Windows Vista Ultimate x64 version 6.0.6000 (build 6000), russian (cp1251)
IDE - Code::Blocks 8.02 Build: Feb 27 2008, 20:59:09 (distrib: "codeblocks-8.02mingw-setup.exe", download: 16.03.2008)
Selected compiler - GNU GCC compiler
Project steps:
File->New->Project->Win32GUI->FrameBased
Delete default code
Insert this code (this code as sample)
Build!
Build log:
-------------- Build: Release in proba ---------------
mingw32-gcc.exe -Wall -O2 -c D:\Projects\CodeBlocks\proba\main.c -o obj\Release\main.o
D:\Projects\CodeBlocks\proba\main.c:10:25: converting to execution character set: Illegal byte sequence
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings
All !
Enough information ?
*/
(Sorry, i bad speek english)
-
-finput-charset=windows-1251 - good
As be if using several language in code ?.
Your code is compiled without any problem when English characters are used, but fails when Russian characters are used. Make sure that the GCC version you are using is linked against iconv. Otherwise the Unicode conversion may not work.