alexa / alexa-skills-kit-sdk-for-nodejs

The Alexa Skills Kit SDK for Node.js helps you get a skill up and running quickly, letting you focus on skill logic instead of boilerplate code.
Apache License 2.0
3.12k stars 736 forks source link

Ampersand & in the audio url not working #120

Closed ghost closed 7 years ago

ghost commented 7 years ago

I think it may be related to https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/issues/25

Going to Skill -> Test -> Voice emulator

Works: <speak><audio src="https://s3.amazonaws.com/sounds226/boom.mp3"/></speak> Works: <speak><audio src="https://s3.amazonaws.com/sounds226/boom.mp3?param1="/></speak> Fails: <speak><audio src="https://s3.amazonaws.com/sounds226/boom.mp3?param1=&param2="/></speak> Works: <speak><audio src="https://s3.amazonaws.com/sounds226/boom.mp3?param1=&amp;param2="/></speak>

Ampersand & doesn't work. I see &amp;works, but not all servers will support the syntax.

knowlsie commented 7 years ago

So pretty much this issue is mentioned in the README. It's because of the SSML tags.

The contents of the prompt and repompt values get wrapped in SSML tags. This means that any special XML characters within the value need to be escape coded. For example, this.emit(":ask", "I like M&M's") will cause a failure because the & character needs to be encoded as &. Other characters that need to be encoded include: < -> <, and > -> >

ghost commented 7 years ago

But &amp; is not decoded back to & in Alexa service, so the URL will be https://s3.amazonaws.com/sounds226/boom.mp3?param1=&amp;param2= and many servers will fail to parse that. Any workaround?

knowlsie commented 7 years ago

Yeah, I totally see the issue, just don't think there's a workaround except removing <speak> tags.