microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.32k stars 677 forks source link

German umlaut in TextBlock not displayed correctly #8200

Open FelixCCWork opened 1 year ago

FelixCCWork commented 1 year ago

Describe the bug

When adding a TextBlock with the Text property set to a text containing a german umlaut (eg. ä,ö,ü) this character is displayed as questionmark. When using x:Bind to bind the Text of a TextBlock to a string in code behinde, it works.

What is really strange, if I change anything in the text and do a Hot-Reload, the characters are displayed correctly!

My windows display language is set to german. The application is build as unpackaged app.

image

Xaml:

<StackPanel
        HorizontalAlignment="Center"
        VerticalAlignment="Center"
        Orientation="Horizontal">
        <TextBlock Text="Passwörter" />
        <TextBlock Text="{x:Bind TestText}" />
</StackPanel>

Steps to reproduce the bug

  1. Build a unpackaged app
  2. Add a TextBlock with the Text property set to 'Passwörter and a TextBlock with the Text bound to a string property in code behind (With same text)
  3. Run the app
  4. -> 'ö' on bound Text is displayed correctly, on the other TextBlock it is displayed as questionmark
  5. Add a space to the Text property (Or change any other character)
  6. Hot-Reload
  7. Character is displayed correctly

Expected behavior

No response

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.2.3: 1.2.230118.102

Windows version

Windows 10 (21H2): Build 19044

Additional context

No response

JaiganeshKumaran commented 1 year ago

This is most probably a code-page issue. Make sure your XAML file is saved in UTF-8.

In Visual Studio, select Tools->Options->Environment->Documents->Save documents as Unicode when data cannot be saved in codepage.

Cataurus commented 1 year ago

This is most probably a code-page issue. Make sure your XAML file is saved in UTF-8.

In Visual Studio, select Tools->Options->Environment->Documents->Save documents as Unicode when data cannot be saved in codepage.

I have the same problem and tried their tip, the problem still exists. This problem also exists only since the last update of Visual Studio 2022.

FelixCCWork commented 1 year ago

The visual studio setting to save document as Unicode does not work for me. I also tried setting the option in the app.manifest file (UTF-8). But this doesen't work either.

Mirofire commented 1 year ago

I have the same problem, but for me it occurs only inside user controls. Directly on a page it is displayed correctly.