Simple example
public class TemplateData {
public string inputstring = "あ";
}
public static string HandleBar()
{
var message = "{{inputstring}}";
var handlebars = Handlebars.Create();
// needed so if statements work properly.
handlebars.Configuration.UseNewtonsoftJson();
var template = handlebars.Compile(message);
var result = template(new TemplateData);
return result;
}
output will not be あ
it is instead, あ
How do I fix this?
It seems Handlebars will escape some characters, so I added unescape code and it worked correctly.
public class TemplateData {
public string inputstring = "あ";
}
public static string HandleBar()
{
var message = "{{inputstring}}";
var handlebars = Handlebars.Create();
// needed so if statements work properly.
handlebars.Configuration.UseNewtonsoftJson();
var template = handlebars.Compile(message);
var result = template(new TemplateData);
result = System.Net.WebUtility.HtmlDecode(result);
return result;
}