Problem with UNICODE and wxWidgets

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
YuMERA
Knows some wx things
Knows some wx things
Posts: 44
Joined: Fri Jul 05, 2019 8:47 pm

Problem with UNICODE and wxWidgets

Post 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 1249 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
Last edited by YuMERA on Fri Jul 05, 2019 11:41 pm, edited 1 time in total.
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Problem with UNICODE and wxWidgets

Post 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.
Use the source, Luke!
YuMERA
Knows some wx things
Knows some wx things
Posts: 44
Joined: Fri Jul 05, 2019 8:47 pm

Re: Problem with UNICODE and wxWidgets

Post by YuMERA »

Thx for answer!
It's one of the solutions, but I would like to know why this happens with automatic creation?
Kvaz1r
Super wx Problem Solver
Super wx Problem Solver
Posts: 357
Joined: Tue Jun 07, 2016 1:07 pm

Re: Problem with UNICODE and wxWidgets

Post 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)
YuMERA
Knows some wx things
Knows some wx things
Posts: 44
Joined: Fri Jul 05, 2019 8:47 pm

Re: Problem with UNICODE and wxWidgets

Post 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
User avatar
doublemax
Moderator
Moderator
Posts: 19114
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Problem with UNICODE and wxWidgets

Post 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.
Use the source, Luke!
YuMERA
Knows some wx things
Knows some wx things
Posts: 44
Joined: Fri Jul 05, 2019 8:47 pm

Re: Problem with UNICODE and wxWidgets

Post 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
Post Reply