- realesmedia
- Posts: 85
- Joined:
[C++] Locale
I trying to display russian symbols, but it displays as squares.
When I use data binding with my locale, program freezes.
1. How to display symbols in russian locale?
2. How to store string data in C++ program? I suppose NsString type not suitable for using with wchar or wstring?
When I use data binding with my locale, program freezes.
1. How to display symbols in russian locale?
Code: Select all
<Label Content="русский текст"/>
- Attachments
-
- Untitled.png (1.35 KiB) Viewed 1962 times
Re: [C++] Locale
We use UTF8 enconding (char*) everywhere. Make sure that you are saving the XAML with UTF8 encoding and also make sure that the font you are using has the corresponding glyphs.
- realesmedia
- Posts: 85
- Joined:
Re: [C++] Locale
XAML code:
C++ code:
Item "Элемент 1" displays with squares.
If i try to use wchar I get an error conversion wchar_t to NsString: instead of .
Code: Select all
<CheckBox FontFamily="fonts/#Arial" Name="CheckListBoxItem" Content="{Binding content}" Tag="{Binding tag}" Checked="OnChecked"/>
Code: Select all
Ptr<CheckListBoxItem> item1 = *new CheckListBoxItem("Элемент 1", 0);
mCheckListBoxItems->Add(item1.GetPtr());
If i try to use wchar I get an error conversion wchar_t to NsString:
Code: Select all
L"Элемент 1"
Code: Select all
"Элемент 1"
Re: [C++] Locale
Ok, try first only with XAML, without code. Something similar to this:
Save the XAML as UTF8 and check the result.
For example, if I try this XAML
Using the standard Roboto font all the character are displayed properly.
Code: Select all
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Background="White">
<Viewbox>
<TextBlock FontFamily="fonts/#Arial" Text="Элемент 1" />
</Viewbox>
</Grid>
For example, if I try this XAML
Code: Select all
<Grid xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Background="White">
<Viewbox>
<TextBlock FontFamily="Fonts/#Roboto" Text="áÁéÉíÍóÓúÚñ€

¹²³¼½¾𝄞" />
</Viewbox>
</Grid>
- realesmedia
- Posts: 85
- Joined:
Re: [C++] Locale
Well, XAML with FontFamily works great. Now I need implementation of C++ sources with hard-coded russian text as in example above.
- realesmedia
- Posts: 85
- Joined:
Re: [C++] Locale
Found solution when string follows after u8-prefix:
Code: Select all
u8"Элемент 1"
Who is online
Users browsing this forum: No registered users and 2 guests