Re: Re[2]: Unexpected encoding issue with _() macro and UTF-8 source in Unicode build (wxWidgets 3.3.1)
Claudio Fabiano Rossato <[email protected]> Sat, 15 Nov 2025 02:42:06 -0800 (PST)
| Newsgroups | gmane.comp.lib.wxwindows.general |
|---|---|
| Message-ID | <[email protected]> |
Hi, Thank you for the clarification — now everything is clear. Claudio. Il giorno venerdì 14 novembre 2025 alle 18:07:59 UTC+1 Vadim Zeitlin ha scritto: > On Fri, 14 Nov 2025 17:46:51 +0100 Claudio Fabiano Rossato wrote: > > CFR> Thanks for the explanation — it clarifies the behavior of |_()|. > CFR> > CFR> I understand now that the argument is always treated as an ASCII key. > I > CFR> still find it surprising that this means a program cannot be written > in > CFR> Italian first and then translated to English. It seems that with > CFR> wxWidgets, multi-language programs must always start with English > strings. > > This is not quite correct, message IDs can use any encoding, it just needs > to be specified in the message catalog. OTOH _all_ "char*" string are > assumed to be in the current locale encoding by wxString, and this is not > specific to _() at all. Unfortunately, while the current locale encoding is > almost always UTF-8 under Unix systems (including macOS), this is almost > never the case under Windows. You may set it explicitly, but if you don't > change the current locale, its encoding will be CP1252 and not UTF-8 by > default. > > If you're sure that all your strings are in UTF-8, you may build wxWidgets > in UTF-8-only mode, but this is not the default. Alternatively, and > actually recommended if you are not working with a legacy code base where > this can be difficult to do, define wxNO_IMPLICIT_WXSTRING_ENCODING when > building your project (you do _not_ have to rebuild wxWidgets for this) to > get errors for all implicit conversions from "char*" as this will force you > to specify the (hopefully correct) encoding for all of them. > > See https://wxwidgets.org/blog/2020/08/implicit_explicit_encoding/ for > more details. > > Regards, > VZ > > -- > TT-Solutions: wxWidgets consultancy and technical support > https://www.tt-solutions.com/ > -- Please read https://www.wxwidgets.org/support/mlhowto.htm before posting. --- You received this message because you are subscribed to the Google Groups "wx-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion visit https://groups.google.com/d/msgid/wx-users/b7bf9f69-f8fa-4b54-befb-154705f4bec4n%40googlegroups.com.