Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Translated by Google:
I am programming a dialog-based MFC app with Visual Studio Community 2019.

I want to use umlauts and unfortunately I get strange special characters.

I enter directly in the resource editor for a CStatic for labeling e.g. E.g. an ö, I get the correct output when the dialog appears.

But if I want to assign a text to a CStatic in OnInitDialog () that contains an ö,
the dialog outputs a special character.

Where is the error? Somewhere a setting seems to be missing because the resource editor can, but the program line fails!

Am I better advised to still formulate in English here or that does not help much because of the special German ö problem.

Original:
Ich programmiere mit Visual Studio Community 2019 eine dialogbasierte MFC-App.

Ich möchte Umlaute setzen und bekomme leider seltsame Sonderzeichen.

Gebe ich direkt im Ressourceneditor für ein CStatic bei Beschriftung z. B. ein ö ein, erhalte ich die richtige Ausgabe, wenn der Dialog erscheint.

Möchte ich aber in OnInitDialog() ein CStatic mit einen Text belegen, der ein ö enthält,
gibt der Dialog ein Sonderzeichen aus.

Wo liegt der Fehler, irgendwo scheint eine Einstellung zu fehlen, weil ja eben der Ressourceneditor kann, die Programmzeile aber fehlschlägt!

Bin ich besser beraten, hier noch in Englisch zu formulieren oder bringt das wenig wegen der speziellen deutschen ö-Problematik.

What I have tried:

GetDlgItem(IDC_STATIC2)->SetWindowTextW(_T("Hello Wörld!"));
Posted
Updated 12-Jul-21 0:20am
v2
Comments
Richard MacCutchan 12-Jul-21 5:54am    
This is an English language site; please translate your question.
merano99 12-Jul-21 15:05pm    
I used VS2015 german version and testet your Problem in InitInstance().

The Call of
SetWindowText( m_pMainWnd->m_hWnd, _T("Hello Wörld!"));

changed the TitleBar of the main window has as expected.

I used the System call here, not the MFC call. Is there a diffence?

Can you post a link to your code?

1 solution

The most common way to solve such problems are escape sequence and I think when you use CStrings and string resources it also is working. Read this i18n article. This is the common workflow in MFC code.

Especially for he so called german umlauts.
 
Share this answer
 
Comments
jfranz 12-Jul-21 8:34am    
Thanks for translation and the fast answer.
Unfortunately escape sequences do not work, nothing is printed e. g. for \x94

I believe my code
GetDlgItem(IDC_STATIC2)->SetWindowTextW(_T("Hello Wörld!"));
is ok so far, because,
I didn't had a problem with those codelines for Umlauts within an older Visual Studio Version.

More precise:
Around 2017 I programmed an app (A) that has no Umlaut-problems with Umlauts (I can't remember which VS-Version)
In 2021 I tried to transfer the project to the newer VS 2019 IDE by creating an empty MFC dialogbased App (B) in VS 2019 and adding the necessary files from (A) into (B) but then discoverd Umlaut-Problems
After this I created this hellowoerld-Project (C) to exclude the possibility that I did something weired in (B) and so discovered that even in the very simple program (C) Umlauts do not work.

Maybe someone can interpret the following icons shown in windows explorer:
the .sln-file for (A) has an icon with a "14" in the right upper corner, where (B) and (C) show a "16".

My target is still not to change code (and make it more complex), but to get former code (A), simple code (C) respectively, run under VS 2019 in a project created with VS 2019, like (B)!
Can anybody help?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900