Closed skriebi closed 2 years ago
You should add your helper like so:
services.AddHandlebarsHelpers(myHelper);
See here.
I think, the property-name template should use the WriteSafeString-Method.
Perhaps you should open an issue on Handlebars.Net, since the templates should use WriteSafeString
? I recommend that, because it would solve the problem of special characters globally.
Reported here: https://github.com/ErikEJ/EFCorePowerTools/issues/77
EF Core team (and I) use UTF8 encoding...
@ErikEJ What do you think I should do to fix this?
Confirmed this is a Handlebars.Net issue. There needs to be a way to suppress HTML encoding. See Issue 276 there.
Closing, as this needs to be fixed by Handlebars.NET.
Re-opening, as this issue was fixed in v2 of Handlebars.Net.
If this option is not checked, Chinese will not be encoded.
The option is: Use Data Annotations
In addition, it is strange that some Chinese is not encoded
In my investigation, I found that some Chinese are not encoded because SuppressEncoding
is true
, because I am not familiar with this project and do not know where to assign SuppressEncoding
This flag was added in Handlebars.Net in v 2 and defaults to true
. I think we just need to set it to false
.
I am wondering how to reproduce the encoding issue on my side. @Varorbc, @ErikEJ Any tips?
Not so.This flag already exists in Handlebar. Net in V1.I think we should find out why some Chinese SuppressEncoding
is false
and some Chinese SuppressEncoding
is true
instead of directly modifying the default value
@Varorbc I think the setting is NoEscape
. According to issue 276 in Handlebars.Net, support for noEscape
was added to Handlebars.Net with PR 375 in 2.0.0-preview-2. I will look into how we can set this to true
.
@Varorbc Please pull down PR #178 and test to see if it resolves encoding issues.
Hello,
some of the columns in our database contains special characters (ä,ö,ü). The characters are converted to
ä
,ö
orü
unicode strings.To solve the issue for me, I have created a hbs-helper, which simple writes the property-name with the WriteSafeString-Method of the TextWriter.
Helper registration:
Usage in templates:
{{f-pn property-name}}
I think, the property-name template should use the WriteSafeString-Method.