Closed jacobweber closed 3 years ago
Looks like this util function is already exist in ask-sdk-core: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/blob/2.0.x/ask-sdk-core/lib/index.ts#L49.
Closing this issue for now, please feel free free to reopen if it dosn't solve your problem :)
I don't think escapeXmlCharacters solves the problem, due to the issue I mentioned above. But I'm not working on this anymore, so I don't personally need it.
I'm submitting a...
It would be useful to have a utility function for escaping rich text, for constructing strings to pass into
Alexa.RichTextContentHelper.withPrimaryText()
.Expected Behavior
Something like
escapeRichText("a & \\ b")
, which would return"a & \\\\ b"
. It would implement the rules here.Current Behavior
We can't use
escapeXmlCharacters
fromSsmlUtils
. It tries to prevent characters from being encoded twice, which would mess with valid text, e.g. if you wanted to display a sample of HTML code to the user like&
.In any case, this isn't a standard HTML-encode, because of the
\\
requirement.Possible Solution
See above.
Context
Nice to have, but not essential.
Your Environment
Node.js and NPM Info