This is a migrated thread and some comments may be shown as answers.

Notify with encoded html

3 Answers 171 Views
Notification
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
Dan asked on 19 Oct 2018, 07:27 AM

I have an application that displays errors with the notification that uses templates.

One of the errors that I got was a telerik error that the template was wrong however the displayed message has interpreted the html code.

Looking in the documentation I saw that to encode the html you should use showText instead of show so I used it but the notification displayed the same thing. The html was not encoded.

Please see the reproduction

https://dojo.telerik.com/eNaBikIm

What can I do so that the message is not interpreted?

3 Answers, 1 is accepted

Sort by
0
Accepted
Nencho
Telerik team
answered on 22 Oct 2018, 12:10 PM
Hello Dan,

It is expected to the message rendered as because it is rendered inside a template. In order to overcome this and have the text rendered as a message, you can use kendo.htmlEncode: 

https://docs.telerik.com/kendo-ui/api/javascript/kendo/methods/htmlencode

Here is the updated dojo example:

https://dojo.telerik.com/@nenchef/isEXOpOJ

Hope this would help.

Regards,
Nencho
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
answered on 23 Oct 2018, 09:05 AM

Hi Nencho,

So I used your solution and it worked until I had to display a message in German that uses an umlaut. And instead of the correct message "Die Gerät wurde gespeichert." I got this: "Die Gerät wurde gespeichert."

Is there a way of knowing that the string needs htmlencode or nor?

0
Nencho
Telerik team
answered on 25 Oct 2018, 08:07 AM
Hello Dan,

Indeed, since the kendo.htmlEncode needs to be used for the initial case- it will contradict with the usage and proper transformation of the an umlaut.

Regards,
Nencho
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Notification
Asked by
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
Answers by
Nencho
Telerik team
Dan
Top achievements
Rank 1
Iron
Iron
Veteran
Share this question
or