You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, when I try the same thing with the .NET version the parsing fail with an error like this:
": 'Reached unparseable token in expression: 姓}}"
Interestingly, if I name my placeholder starting with ASCII characters (ex: {{a姓}}, or {{_姓}}) it works well no matter how many UTF-8 characters there is inside the placeholder
So it really seems that the first character is somehow important
Is this a limitation of the .NET implementation ? Or maybe I need to change some settings ?
In the worst case I'm thinking, maybe I can do a pre-treatment to change placeholders like {{姓}} into something like {{_姓}}
But it's still a cumbersome, so if some solution can be found I would be happy
@mhornbacher , I did some research some time ago and looks like the problem is in WordParser and the way it validates first char by using predefined list in ValidWordStartCharactersString. Instead of that it should validate if it's valid literal char plus $, ., @, [, ] (maybe some other chars as well).
I have the same issue. When I read file with utf-8 content and pass dictionary with utf-8 content it returns result with correct chars from file but unknown ones in placeholders.
Activity
oformaniuk commentedon Jan 22, 2021
Hello @Sigma87
This one definitely looks like a bug in Handlebars.Net parser as per Handlebars spec most of UTF-8 chars are fine.
mhornbacher commentedon Mar 3, 2021
@Sigma87 do you have a basic implementation example that fails?
sylvain-pajaud commentedon Mar 4, 2021
I'm not sure if I understand well your question but I'll try to answer
The example I provided just before fails:
The Compile method throws a HandlebarsDotNet.HandlebarsParserException:
But this does not fails:
The execution continues normally
It's why I said that the first character seems to be important (If it is non-ascii it bugs)
By the way I saw the same issue with helpers:
Also throws a HandlebarsDotNet.HandlebarsParserException:
mhornbacher commentedon Mar 4, 2021
Perfect so
Handlebars.Compile("Hello {{姓}} {{名}}");fails right?I'll try to find some time to clone this over the weekend and begin taking a look at this if no one else picks it up.
oformaniuk commentedon Mar 6, 2021
@mhornbacher , I did some research some time ago and looks like the problem is in
WordParserand the way it validates first char by using predefined list inValidWordStartCharactersString. Instead of that it should validate if it's valid literal char plus$,.,@,[,](maybe some other chars as well).mhornbacher commentedon Mar 11, 2021
Thanks, looks promising
sylvain-pajaud commentedon Oct 10, 2021
Hi,
Sorry, is there any update about this issue ?
mhornbacher commentedon Oct 10, 2021
It sadly slipped off my plate. Perhaps I'll make some time tomorrow to take another crack at it. Thank you for bringing it back to my attention :)
davidkhachatryan123 commentedon Mar 4, 2025
I have the same issue. When I read file with utf-8 content and pass dictionary with utf-8 content it returns result with correct chars from file but unknown ones in placeholders.
Merge pull request #620 from Handlebars-Net/worktree-agent-afe0501761…
fix: allow Unicode letters as first character in identifiers (issue H…