Skip to content

[PORT] update expression escape #1939

@tomlm

Description

@tomlm

Port this change from botbuilder-dotnet/master branch:
microsoft/botbuilder-dotnet#3580

close: #3510
update Expression escape policy to make expression achieve higher robustness.

the new strategy of expression evaluation about escape characters is as below:

  • in any case, \n, \r, \t, \\ would be unescaped.
  • In double quotation mark string, \" would be unescaped. There is no need to escape `and ' in double quotation mark string
  • In single quotation marks string, \' would be unescaped. There is no need to escape ` and " in single quotation mark string
  • in string interpolation mode, \` and \$ would be unescaped
  • other characters that have \ prefix, would leave it as is
    samples:
expression result description
`hi\`` hi` support ` escape in string interpolation
`\${a}` ${a} escape $ in string interpolation
"ab\"cd" ab"cd escape " in double quot string
'ab\'cd' ab'cd escape ' in single quot string
"ab`cd" ab`cd no need to escape ` in normal string(' or ")
"ab\ncd" ab [newline] cd newline would be unescaped
`hi\y` hi\y unrecognized escape character would not be unescaped
"ab\ycd" ab\ycd unrecognized escape character would not be unescaped

Changed projects

  • AdaptiveExpressions
  • AdaptiveExpressions.Tests
  • Microsoft.Bot.Builder.LanguageGeneration.Tests

[LG,R9]

Metadata

Metadata

Assignees

No one assigned

    Labels

    R9Release 9 - May 15th, 2020

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions