## wxT Macro fails

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
goeba
Earned a small fee
Posts: 21
Joined: Tue May 17, 2005 8:13 pm

### wxT Macro fails

Hi,

I´m using wxT on the following string:

wxT("\\lstset{ inputencoding=utf8, literate={ä}{{\\\"a}}1 {ö}{{\\\"o}}1 {ü}{{\\\"u}}1 {Ä}{{\\\"A}}1 {Ö}{{\\\"O}}1 {Ü}{{\\\"U}}1 {ß}{{\\\"s}}1 {´}{{'}}1,}\n") <<

It´s for creating a LaTeX-File, that is why there are so many backslashes.

The macro fails with

Code: Select all

home/linux/Downloads/wxWidgets-3.1.0/include/wx/chartype.h:210:44: error: converting to execution character set: Ungültiges oder unvollständiges Multi-Byte- oder Wide-Zeichen
***              #define wxT(x) wxCONCAT_HELPER(L, x)
***                                             ^
***  #define wxCONCAT_HELPER(text, line) text ## line
***                                      ^
*** kartei.cpp:326:5: note: in expansion of macro ‘wxT’
***      wxT("\\lstset{ inputencoding=utf8, literate={
*** }}1 {
*** }}1 {
*** }}1 {
*** }}1 {
*** }}1 {
*** }}1 {
*** }}1 {
*** }\n") <<
***      ^
Makefile:239: recipe for target 'GCCReleaseGTK/kartei.o' failed
*** make: *** [GCCReleaseGTK/kartei.o] Error 1

Do you think it´s a bug, should I submit it? The only multibyte-Characters here are umlauts.

doublemax
Moderator
Posts: 14897
Joined: Fri Apr 21, 2006 8:03 pm

### Re: wxT Macro fails

Compiles for me with VS2013 under Windows.

But because of the many slashes need to escape slashes and quotes, i personally would put that in an external file with some placeholders for the variable parts. That would make maintaining this much easier.
Use the source, Luke!

goeba
Earned a small fee
Posts: 21
Joined: Tue May 17, 2005 8:13 pm

### Re: wxT Macro fails

@xaviou: I thought that using wxT( ...) should make it possible to build unicode apps using a different source encoding. Dialog Blocks doesn´t offer the possibility to change the source-encoding after project-start, so I´m afraid that I´d mess up the project when doing this myself.

@doublemax: I thought so, too, to avoid that problem on one hand, to make this more flexible on the other.

I think I´ll write Julian a message to ask what Dialog BLocks does with the iso-8859-1 encoded source-file.

I really hate all this encoding-stuff. I really wish that someone 50 years ago would have invented unicode right from the start ...

This is an old program which I am currently porting to linux (from windows, using wx ansi 2.. I have to deal with the fact that the files produced by the application are windows-encoded, that the LaTeX-Export must take care of the right encoding and all this ... But you all know that when you´re 95% done, 95% of the work begin