Handlebars.Net
Handlebars.Net copied to clipboard
[Question] Is there a way to ensure emoji's are properly handled?
Hi, First of all. Thank you, a lot, for the work done so far. We are using the latest version of HandlebarsDotNet.
We are trying to convert a template with parameters containing an emoji. Find below a code snippet.
var template = "Put here some text and '{{title}}'";
var params = new { title = "😆Smile has issues" };
var render = Handlebars.Compile(template);
var subject = render(parameters);
The result will be
"Put here some text and '��Smile has issues'";
Is there a way to keep the same output even with emojis?
Thank you for your feedback, Patrick
Hello @plamber . You see this behavior because of default encoding. In order to preserver emojis you'd need to implement your own encoder or disable it all together.
Hi @zjklee, Thank you very much. Do you have a suggestion on how such an encoder can be implemented and injected?
Thank you, Patrick
Thank you. I will have a look into that.