Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing encoding property breaks code generating #810

Open
tongpeifu-yh opened this issue Mar 26, 2024 · 1 comment
Open

Changing encoding property breaks code generating #810

tongpeifu-yh opened this issue Mar 26, 2024 · 1 comment

Comments

@tongpeifu-yh
Copy link

tongpeifu-yh commented Mar 26, 2024

  1. Problem
    After changing c++ encoding property from UTF-8 to ANSI (which I think should be Windows native encodings like GBK and so on) , the generated files are empty.
  2. Environment
    Windows 10 22H2
    wxFormBuilder 4.1.0 x64 from github release

PS: I am using Visual Studio, so I want native encodings. VS does not support UTF-8 well (at least in my case).

@sodevel
Copy link
Member

sodevel commented Mar 26, 2024

The ANSI option is actually the encoding ISO 8859-1 also known as Latin-1. You receive empty files because your wxFB project files contain characters that can't be represented in this encoding and the wxWidgets string conversion functions return an empty string in that case.

There is not much you can do about it, either use only ISO 8859-1 characters (this is basically 7-Bit ASCII plus some european characters) or use the UTF-8 encoding. I don't know which Visual Studio version you are using, the oldest i can remember is Visual Studio 2015, and this version already supports the option /source-charset:utf-8. With this option you can correctly read UTF-8 source files without changing your execution charset, this way your application can still use your systems narrow charset, the compiler will translate the UTF-8 encoding to your used encoding, like GBK. This of course only works if the UTF-8 only contains characters of that charset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants