Skip to content

Commit

Permalink
fix: handle double quotes and new lines
Browse files Browse the repository at this point in the history
  • Loading branch information
naomi-lgbt committed Dec 19, 2024
1 parent bd83caf commit 91a6ee5
Show file tree
Hide file tree
Showing 5 changed files with 1,196 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Deepgram/Clients/Speak/v2/WebSocket/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@ public async Task<bool> Subscribe(EventHandler<UnhandledResponse> eventHandler)
/// <param name="text">The string of text you want to be converted to audio.</param>
public void SpeakWithText(string text)
{
TextSource textSource = new TextSource(text);
TextSource textSource = new TextSource(text.Replace("\r\n", "\\n")
.Replace("\n", "\\n")
.Replace("\"", "\\\""));
byte[] byteArray = Encoding.UTF8.GetBytes(textSource.ToString());
SendMessage(byteArray);
}
Expand Down
Loading

0 comments on commit 91a6ee5

Please sign in to comment.