Problem with local encoding

General questions regarding the usage of CodeLite
ultrajunkie
CodeLite Curious
Posts: 3
Joined: Mon Mar 20, 2017 11:05 pm
Genuine User: Yes
IDE Question: C++
Contact:

Problem with local encoding

Post by ultrajunkie » Tue Dec 01, 2020 2:31 pm

I am using German local encoding in cpp source files (in comments and strings to be displayed on the sceen). The files are generated (e. g. wxCrafter) and initially come with UTF-8 encoding.

Obviously UTF-8 will spoil the characters during compilation. So far so clear.

When I convert the source files to ANSI coding (using Notepad++) I have no problems, neither with the display in the Codelite Editor nor during compilation.

I tried to set the Codelite preferences to ISO-8859-1, but it looks like the file conversion during file save is not working. The source files stay with UTF-8 (fortunately also with ANSI when I have converted them manually). If I create a new file, coding is shown as Windows-1255 (again according to Notepad++) which is Hebrew :o :shock: !

What am I doing wrong?

DavidGH
CodeLite Plugin
Posts: 701
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: Problem with local encoding

Post by DavidGH » Tue Dec 01, 2020 2:54 pm

I am using German local encoding in cpp source files (in comments and strings to be displayed on the sceen).
Don't. Instead you should mark those strings as being for translation.

(Warning: I write programs in English, so my knowledge and understanding of this may be <100%. And I use Linux, so platform differences are possible.)

I expect the details vary between toolkits but, for wxWidgets programs like CodeLite, that means changing "This string will be seen by users" to _("This string will be seen by users").

You (or someone else) would then need to provide suitable translations for those strings. As part either of building or distributing your program, those translations would then be 'compiled' to .mo files, which are recognised by the wxLocale system.

For more (and more reliable) information see the wxWidgets Internationalisation overview and the Internationalisation sample; and wxForum has many relevant threads.

Regards,

David

Post Reply