jhudsl / mscstts

R Client for the Microsoft Cognitive Services Text to Speech REST API
GNU General Public License v3.0
8 stars 6 forks source link

HTML characters cause errors in ms_synthesize #1

Closed revodavid closed 6 years ago

revodavid commented 6 years ago

The < in this call causes it to throw a "bad request" error:

ms_synthesize("hello < dave", output_format = "audio-16khz-128kbitrate-mono-mp3")

You may need to sanitize the text input before sending it to the Bing Speech API. As a workaround, I just filtered my inputs with gsub("[<>/]","",text).

muschellij2 commented 6 years ago

Seems related to SSML spec in general: https://github.com/alexa/alexa-skills-kit-sdk-for-nodejs/issues/25. I'll look into escaping things. I will likely have an option for this. One reason I don't want to auto-escape is that you could potentially put valid SSML in there and I'd want that option to work.

muschellij2 commented 6 years ago

Please see escape argument now, which will do your subs, as well as & to "and", which may not be 100% of the desired behavior but probably is). Using new dev version should work and I'll push to CRAN next week.