Author Topic: Problems with umlaut in wxSmith  (Read 13000 times)

Offline geronet

  • Multiple posting newcomer
  • *
  • Posts: 14
Problems with umlaut in wxSmith
« on: August 02, 2006, 06:17:19 pm »
Hello ;)

wxSmith is a great Tool, but if i use an umlaut like "C" in a dialog i get this:



I wanted to compile with unicode enabled, but there i get errors with every string in the code.. I don't know why. How can i fix this problem?

Thanks in advance, Stefan

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: Problems with umlaut in wxSmith
« Reply #1 on: August 02, 2006, 06:56:37 pm »
I wanted to compile with unicode enabled, but there i get errors with every string in the code.. I don't know why. How can i fix this problem?
There is a nice article on how to prepare wxWidgets code for unicode e.g here: http://www.wxwindows.org/manuals/2.6.3/wx_unicode.html. Keep in mind that you have to compile the wxWidgets lib(s) for unicode, too and setup your C::B project appropriately (or use the wizard to create a stub for you).

With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline geronet

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Problems with umlaut in wxSmith
« Reply #2 on: August 03, 2006, 05:57:02 pm »
And what should i do without unicode?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: Problems with umlaut in wxSmith
« Reply #3 on: August 03, 2006, 06:02:55 pm »
And what should i do without unicode?
I thought your intenetion was to compile unicode. I wonder why you want to design yyour application in ANSI. Does this becasue you have to be compatible to Win9x or similar? Otherwise I'd suggest you start with unicode right from the start...?!
If you want ANSI you could try to use the ASCii code instead, maybe?!
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9496
Re: Problems with umlaut in wxSmith
« Reply #4 on: August 03, 2006, 06:07:54 pm »
Hmmm... now I wonder: I used the wizard to create a wxWidgets ANSI application and changed the "About" message to:
Code: [Select]
wxMessageBox(msg, _("Welcome to C"));
I get a message as attached - thus: This actually works! I'm not sure what you're doing wrong. What's your sys config? (Mine is WXP-SP2, German).
With regards, Morten.

[attachment deleted by admin]
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline geronet

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Problems with umlaut in wxSmith
« Reply #5 on: August 03, 2006, 10:42:30 pm »
I have WinXP SP2 (German), the latest C::B and gcc.

If i change the text label from the program with
Code: C
  1. StaticText3->SetLabel(_T("C"));
it is correctly displayed, but that's not a solution.

In the .xrc it is also correct:
Code: C
  1. <label>C</label>

Any Suggestions? (perhaps in German?) ;)

Offline geronet

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Problems with umlaut in wxSmith
« Reply #6 on: August 04, 2006, 09:14:25 pm »
If i try to compile with unicode enabled, i get a lot of errors with every string:

main.cpp:213:1: converting to execution character set: Illegal byte sequence

Line 213:
           wxMessageBox(_T("Konfigurationsdatei ist beschdigt!"), _T("Fehler"));

The problem is the "", if i delete it the error is gone...

Offline geronet

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Problems with umlaut in wxSmith
« Reply #7 on: August 04, 2006, 10:29:39 pm »
I'm stuck now. If i compile in ANSI mode, i get dialogs like shown in the first post.
If i compile in unicode mode, i get errors because of the char '' in the string shown here:
Code: C
  1. Textfield[i]->SetLabel(wxString::Format(_T("%.1fC"), *(T[i].value)));

And now? I don't know..

Offline kagerato

  • Multiple posting newcomer
  • *
  • Posts: 56
    • kagerato.net
Re: Problems with umlaut in wxSmith
« Reply #8 on: August 05, 2006, 05:57:59 pm »
I'm stuck now. If i compile in ANSI mode, i get dialogs like shown in the first post.
If i compile in unicode mode, i get errors because of the char '' in the string shown here:
Code: C
  1. Textfield[i]->SetLabel(wxString::Format(_T("%.1fC"), *(T[i].value)));

And now? I don't know..

Are your source files using an ANSI encoding?  If so, try using UTF-8.

Offline geronet

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Problems with umlaut in wxSmith
« Reply #9 on: August 05, 2006, 10:05:15 pm »
Code: C++
  1.  Textfield[i]->SetLabel(wxString::Format(_T("%.1f\x00B0C"), *(T[i].value)));
with the help of the chart
http://www.unicode.org/charts/PDF/U0080.pdf

displays the character correctly on Linux, with msw i get some undefined character.
Maybe the cpp-file on Windows is ANSI? How can i change that?
On Linux i get
Quote
file main.cpp
main.cpp: ISO-8859 C program text, with CRLF, LF line terminators

Offline geronet

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Problems with umlaut in wxSmith
« Reply #10 on: August 06, 2006, 06:01:29 pm »
It's ok now, i converted the file to utf-8 with "iconv -f ISO-8859-1 -t UTF-8 main.cpp" and now i have to insert the character
Code: [Select]
Textfield[i]->SetLabel(wxString::Format(_T("%.1f°C"), *(T[i].value)));and it displays correctly ;)

PS: The C:B Editor doesn't show the correct character, it is displayed like here (two bytes, one A with ^on it and a ), but C:B is compiled with unicode enabled?!
« Last Edit: August 06, 2006, 06:03:37 pm by geronet »

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1442
    • CenizaSOFT
Re: Problems with umlaut in wxSmith
« Reply #11 on: August 06, 2006, 07:53:31 pm »
Did you try Edit->File encoding->UTF-8?

Offline geronet

  • Multiple posting newcomer
  • *
  • Posts: 14
Re: Problems with umlaut in wxSmith
« Reply #12 on: August 06, 2006, 08:16:36 pm »
Ah, that's it :D

Didn't see that menu.. Thanks a lot.