Skip to content

HandleBars.Compile replaces '\\' (double backslash) with '\' single backslash #462

Description

@bascoder

What

When the template contains a double backslash. The result only contains a single backslash.

Reproduction

To reproduce I wrote the following unit test:

[TestMethod]publicvoidCompile_WithDoubleBackslashes_ReturnsExpectedString(){stringtemplate=@"\\";varcompiledTemplate=Handlebars.Compile(template);stringresult=compiledTemplate(null);Assert.AreEqual(@"\\",result);}

It fails with message:
Assert.AreEqual failed. Expected:<\\>. Actual:<\>.

Here I would expect that the result string contains the double backslash.

Workaround

To workaround this issue I can change the template to string template = @"\\\\".

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions