Page 1 of 1

Problem with UNICODE and wxWidgets

Posted: Fri Jul 05, 2019 9:16 pm
by YuMERA
I try to write test app in code blocks 17.12 and wxWidgets 3.1.2 and I have one problem on the start.
In the editor, I place one wxButton and one wxStaticText with some letters in the Serbian language.
SharedScreenshotEditor.jpg
SharedScreenshotEditor.jpg (79.28 KiB) Viewed 259 times
when I compile code and run exe i have this :
SharedScreenshotExe.jpg
For button editor generate automatic code :

Code: Select all

Button1 = new wxButton(this, ID_BUTTON1, _("Naša Slova ŠĐČĆŽ"), wxPoint(104,64), wxSize(152,48), 0, wxDefaultValidator, _T("ID_BUTTON1"));
when I change this to :

Code: Select all

Button1 = new wxButton(this, ID_BUTTON1, _T("Naša Slova ŠĐČĆŽ"), wxPoint(104,64), wxSize(152,48), 0, wxDefaultValidator, _T("ID_BUTTON1"));
i have correct exe
SharedScreenshotExeRight.jpg
problem is when I change any on the editor and save changes editor convert again this to the default style

Code: Select all

new wxButton(this, ID_BUTTON1, _("Naša Slova ŠĐČĆŽ"), wxPoint(104,64), wxSize(152,48), 0, wxDefaultValidator, _T("ID_BUTTON1"));
where is the problem and how solved this.?

Thx. YuMERA

Re: Problem with UNICODE and wxWidgets

Posted: Fri Jul 05, 2019 11:18 pm
by doublemax
I don't know CodeBlocks or wxSmith, but i guess there is an option somewhere where you can change that behavior.

As a workaround you could add code to change the button label after creation.

Code: Select all

//*)   <-- this marks the end of the auto-generated code
Button1->SetLabel( _T("Naša Slova ŠĐČĆŽ") );
It's not nice, but it should get you going until you find a proper solution.

Re: Problem with UNICODE and wxWidgets

Posted: Fri Jul 05, 2019 11:39 pm
by YuMERA
Thx for answer!
It's one of the solutions, but I would like to know why this happens with automatic creation?

Re: Problem with UNICODE and wxWidgets

Posted: Sat Jul 06, 2019 6:31 am
by Kvaz1r
I also don't use CodeBlocks or wxSmith but you can try change encoding to unicode(encoding settings) and (or) avoid using macro '_' (there is corresponding settings, maybe "Settings->Editor->wxSmith Settings->Other Settings->Non I18N Strings" or something like that)

Re: Problem with UNICODE and wxWidgets

Posted: Sat Jul 06, 2019 8:36 am
by YuMERA
Hi Kvazir. First thanx for Your answer.
I tried to change various settings encoding but without success.

My wxSmith settings look like this (this is default I did not change anything)
SharedScreenshotWxSetings.jpg

Re: Problem with UNICODE and wxWidgets

Posted: Sat Jul 06, 2019 8:38 am
by doublemax
"Use I18N" means that you're supporting multiple languages through external language files. If you don't do that and just want the string to appear as it is, uncheck that box.

Re: Problem with UNICODE and wxWidgets

Posted: Sat Jul 06, 2019 9:01 am
by YuMERA
Yes, I uncheck this box and now is OK.
Thank you very much.
I've been looking for a solution for days and now I've only succeeded thanks to you @doublemax and @Kvazir.
Thanks again and I want you all well