We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6e516d2 commit fd46fa9Copy full SHA for fd46fa9
lib/pa_ess/updater.ex
@@ -188,7 +188,7 @@ defmodule PaEss.Updater do
188
text -> {"Matthew", text}
189
end
190
191
- text = ~s(<speak><amazon:effect name="drc">#{text}</amazon:effect></speak>)
+ text = ~s(<speak><amazon:effect name="drc">#{xml_escape(text)}</amazon:effect></speak>)
192
193
http_poster.post(
194
"#{watts_url}/tts",
@@ -207,4 +207,14 @@ defmodule PaEss.Updater do
207
defp create_tag() do
208
:rand.bytes(16) |> Base.encode64(padding: false)
209
210
+
211
+ defp xml_escape(text) do
212
+ String.replace(text, ~w(" ' < > &), fn
213
+ "\"" -> """
214
+ "'" -> "'"
215
+ "<" -> "<"
216
+ ">" -> ">"
217
+ "&" -> "&"
218
+ end)
219
+ end
220
0 commit comments