Chinese display messy after setting GridView theme

1 Answer 122 Views
GridView
Mingchang
Top achievements
Rank 1
Iron
Iron
Mingchang asked on 15 Sep 2021, 07:34 AM

Hi,

Many Chinese characters are displayed incorrectly when set theme for  GridView.

The display is correct when no theme is set.

I uploaded an app. It is displayed correct in left, and incorrectly in right.

天安 门  display as  
包    display as  

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 20 Sep 2021, 10:35 AM

Hello Mingchang,

The described behavior can be observed in almost all text editors on my machine. This includes, any WPF TextBlock, the Notepad and Notepad++ software and even on MS Word. It looks like Windows defaults to the Japanese characters which brings the different visualization. In order to ensure that the proper characters are displayed, you will need to set explicitly set the Language property of the corresponding text element. For example:

<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="Name">
	<telerik:GridViewDataColumn.CellTemplate>
		<DataTemplate>
			<TextBlock Text="{Binding Name}" Language="zh-cn" />
		</DataTemplate>
	</telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn> 

Note that on my side both gridviews (left and right) were showing the wrong characters, so it is possible that this relates to a setting of the Windows OS.

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Mingchang
Top achievements
Rank 1
Iron
Iron
commented on 22 Sep 2021, 12:34 AM

Hi Martin Ivanov,

When I set the theme to Expression_Dark、windows7、Vista, the characters are displayed correctly.So inside the GridView, are there different ways to render characters?

These theme display normally:Expression_Dark、windows7、Vista、Transparent、Summer、Office_Blue

These themes are not normal:Windows8、Windows8Touch、Office2013、Office2016

We have customers all over the world, how can we set up to get our own customers' language?

Mingchang
Top achievements
Rank 1
Iron
Iron
commented on 22 Sep 2021, 12:40 AM

Hi,

I hope  that you can  examine the code further to see why different themes display different behaviors.

Martin Ivanov
Telerik team
commented on 22 Sep 2021, 09:30 AM

I've tested all the mentioned themes on my side, using your project, but I wasn't able to show the correct character. Whatever theme I use I got the wrong one.

There is no specific logic that changes the culture based on the selected Telerik theme. The only major difference that may affect this is that some of the themes may use different FontFamily. My guess here is that the combination between the FontFamily and the Windows OS settings is causing this difference.

If you want to apply the language setting on a more global level, you can set the Language property of the MainWindow.

<Window Language="zh-cn"
To set the Language property in code, you can use the following snippet:

window.Language = XmlLanguage.GetLanguage("zh-ch");

 

 
Mingchang
Top achievements
Rank 1
Iron
Iron
commented on 28 Sep 2021, 12:26 AM

Hi Martin Ivanov,

On your computer, all the themes are displayed incorrectly, so I think that should be taken more seriously. Should you fix it as an issue or bug now that you have found that the display is incorrect?

 

Martin Ivanov
Telerik team
commented on 29 Sep 2021, 11:24 AM

Hello Mingchang Bai,

I understand that this is not a convenient situation. However, please note that the reported issue is not related to the Telerik themes or the RadGridView control. This is a combination between the Windows OS culture settings and the .NET framework globalization support. The issue is reproducible with big number of text-based software on my machine (like Notepad, Notepad++, all web browsers and few more) and also you can reproduce it with a simple WPF TextBox without any Telerik components.

We cannot commit to a fix on our side because this should include reading the provided text and translating it from the concrete language, and then setting the language of the control. If we place aside the fact that this is not very reliable as a solution because the translation may not be very correct, this means that we are going to set a common property secretly (in the source code of the control) which will cause confusion in projects that rely on that property. Also, because of the similarity between Chinese and Japanese characters encoding and how the .NET framework interpret those, it won't be very clear how to determine which language should be used. 

It sounds more appropriate to make the decision about the external texts globalization settings on the application level.

Tags
GridView
Asked by
Mingchang
Top achievements
Rank 1
Iron
Iron
Answers by
Martin Ivanov
Telerik team
Share this question
or