Problem with UNICODE and wxWidgets Topic is solved

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
Earned a small fee
Earned a small fee
Posts: 18
Joined: Fri Jul 05, 2019 8:47 pm

Problem with UNICODE and wxWidgets

Post by YuMERA » Fri Jul 05, 2019 9:16 pm

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 269 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: 14190
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Problem with UNICODE and wxWidgets

Post by doublemax » Fri Jul 05, 2019 11:18 pm

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
Earned a small fee
Earned a small fee
Posts: 18
Joined: Fri Jul 05, 2019 8:47 pm

Re: Problem with UNICODE and wxWidgets

Post by YuMERA » Fri Jul 05, 2019 11:39 pm

Thx for answer!
It's one of the solutions, but I would like to know why this happens with automatic creation?

Kvaz1r
Earned some good credits
Earned some good credits
Posts: 132
Joined: Tue Jun 07, 2016 1:07 pm

Re: Problem with UNICODE and wxWidgets

Post by Kvaz1r » Sat Jul 06, 2019 6:31 am

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
Earned a small fee
Earned a small fee
Posts: 18
Joined: Fri Jul 05, 2019 8:47 pm

Re: Problem with UNICODE and wxWidgets

Post by YuMERA » Sat Jul 06, 2019 8:36 am

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: 14190
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Problem with UNICODE and wxWidgets

Post by doublemax » Sat Jul 06, 2019 8:38 am

"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
Earned a small fee
Earned a small fee
Posts: 18
Joined: Fri Jul 05, 2019 8:47 pm

Re: Problem with UNICODE and wxWidgets

Post by YuMERA » Sat Jul 06, 2019 9:01 am

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