UTF-8 Build on Windows

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.
User avatar
AlSith
Knows some wx things
Knows some wx things
Posts: 30
Joined: Fri Dec 20, 2019 7:43 am

Re: UTF-8 Build on Windows

Post by AlSith »

I made the example with a simple Visual Studio project.
I have created and run the executable in Debug mode and it works fine.

Created a standard wxString

Code: Select all

wxString s("Ciao è");
, I can print it correctly with any method, but the size of wxStringCharType is always 2 bytes.

Under OS Linux, the same example (but I have to create wxString with the method

Code: Select all

wxString s = wxString::FromUTF8("Ciao è");
) is printed correctly with the classic method

Code: Select all

s.c_str();
and the size of wxStringCharType is 1 byte.
Do or Do Not; there is No Try.
Before giving good Advice, good Examples must be given.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: UTF-8 Build on Windows

Post by PB »

FWIW, I was able to produce a MSW UTF-8 build and successfully launch a simple program using it:
wxutf8.PNG
wxutf8.PNG (10.09 KiB) Viewed 1050 times
(one can display this dialog by <Ctrl>+<Alt>+<MiddleClick> in an area not occupied by a child control).


wxutf8-2.png
wxutf8-2.png (3.67 KiB) Viewed 1049 times

I used nmake, had to modify WXWIN/build/msw/config.vc where I changed the line

Code: Select all

CPPFLAGS = 
to

Code: Select all

CPPFLAGS = /DwxUSE_UNICODE_UTF8=1
I also used the define in the MSVS project properties in preprocessor symbols.

If you do not mind AlSith, I will ask about how to do this officially in wx-users mailing list.
User avatar
AlSith
Knows some wx things
Knows some wx things
Posts: 30
Joined: Fri Dec 20, 2019 7:43 am

Re: UTF-8 Build on Windows

Post by AlSith »

PB wrote: Mon Dec 23, 2019 4:38 pm FWIW, I was able to produce a MSW UTF-8 build and successfully launch a simple program using it:
wxutf8.PNG
(one can display this dialog by <Ctrl>+<Alt>+<MiddleClick> in an area not occupied by a child control).

I used nmake, had to modify WXWIN/build/msw/config.vc where I changed the line

Code: Select all

CPPFLAGS = 
to

Code: Select all

CPPFLAGS = /DwxUSE_UNICODE_UTF8=1
I also used the define in the MSVS project properties in preprocessor symbols.
Thanks.. I try now
PB wrote: Mon Dec 23, 2019 4:38 pm If you do not mind AlSith, I will ask about how to do this officially in wx-users mailing list.
Ok.. no problem... explain to me how I can help you and I will :D
Do or Do Not; there is No Try.
Before giving good Advice, good Examples must be given.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: UTF-8 Build on Windows

Post by PB »

Just make sure to make a clean rebuild of the library once you change the make config. I would also strongly recommend setting the same define in your project.
AlSith wrote: Mon Dec 23, 2019 4:45 pm
PB wrote: Mon Dec 23, 2019 4:38 pm If you do not mind AlSith, I will ask about how to do this officially in wx-users mailing list.
Ok.. no problem... explain to me how I can help you and I will :D
I will just ask there, no help from you required, but thanks anyway. ;)

TBH, I am still not sure that you really want an UTF-8 build, for the reasons I described in my very first post in this thread...
User avatar
AlSith
Knows some wx things
Knows some wx things
Posts: 30
Joined: Fri Dec 20, 2019 7:43 am

Re: UTF-8 Build on Windows

Post by AlSith »

PB wrote: Mon Dec 23, 2019 4:38 pm FWIW, I was able to produce a MSW UTF-8 build and successfully launch a simple program using it:
wxutf8.PNG
(one can display this dialog by <Ctrl>+<Alt>+<MiddleClick> in an area not occupied by a child control).



wxutf8-2.png


I used nmake, had to modify WXWIN/build/msw/config.vc where I changed the line

Code: Select all

CPPFLAGS = 
to

Code: Select all

CPPFLAGS = /DwxUSE_UNICODE_UTF8=1
I also used the define in the MSVS project properties in preprocessor symbols.


Great.. it works..!!

:D :D =D> =D>
Do or Do Not; there is No Try.
Before giving good Advice, good Examples must be given.
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: UTF-8 Build on Windows

Post by PB »

I asked in wx-users about this, lets see what the answer is (probably only once holidays are over):
https://groups.google.com/forum/#!topic ... _tkJ20ilgU

See also this, regarding the "official" support for doing that
https://groups.google.com/forum/#!topic ... _tkJ20ilgU
Post Reply