Special characters (like Ü,Ä,Ö) are not correctly

2019-07-08 17:16发布

问题:

Have an issue by using the Template10 for UWP apps. If i want to display special characters at design time everything seems to be ok. At runtime special characters would not be displayed correctly as you can see in screenshots.

<!--  page header  -->
    <controls:PageHeader Content="Übersicht">
        <controls:PageHeader.SecondaryCommands>
            <AppBarButton Click="{x:Bind ViewModel.GotoSettings}" Label="Settings" />
            <AppBarButton Click="{x:Bind ViewModel.GotoPrivacy}" Label="Privacy" />
            <AppBarButton Click="{x:Bind ViewModel.GotoAbout}" Label="About" />
        </controls:PageHeader.SecondaryCommands>
    </controls:PageHeader>

For example "Übersicht" -> VisualStudio Designer "Übersicht" -> Runtime "?bersicht"

Designer view

Runtime

回答1:

If you use string resources (.resw files), the characters will also appear correctly:

XAML: x:Uid="..."

C#: ResourceLoader.GetForViewIndependentUse().GetString("...");



回答2:

Did you set your PrimaryLanguageOverride?

You're dealing with UTF-8 by default, so I'd normally expect it to be fine but in this instance if you don't wish to set your localization you can substitute unicode &#220; to reliably display Ü