diff --git a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/TextToSpeech.java b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/TextToSpeech.java index c4f787fd92f..50ad03c255c 100755 --- a/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/TextToSpeech.java +++ b/text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/TextToSpeech.java @@ -30,10 +30,7 @@ import com.ibm.watson.developer_cloud.text_to_speech.v1.model.Phoneme; import com.ibm.watson.developer_cloud.text_to_speech.v1.model.Pronunciation; import com.ibm.watson.developer_cloud.text_to_speech.v1.model.Voice; -import com.ibm.watson.developer_cloud.util.GsonSingleton; -import com.ibm.watson.developer_cloud.util.ResponseConverterUtils; -import com.ibm.watson.developer_cloud.util.ResponseUtils; -import com.ibm.watson.developer_cloud.util.Validator; +import com.ibm.watson.developer_cloud.util.*; import okhttp3.Request; import okhttp3.RequestBody; @@ -215,9 +212,10 @@ public ServiceCall synthesize(final String text, final Voice voice, String customizationId) { Validator.isTrue((text != null) && !text.isEmpty(), "text cannot be null or empty"); Validator.isTrue(voice != null, "voice cannot be null or empty"); + String encodedText = RequestUtils.encode(text); final RequestBuilder request = RequestBuilder.get(PATH_SYNTHESIZE); - request.query(TEXT, text); + request.query(TEXT, encodedText); request.query(VOICE, voice.getName()); request.query(ACCEPT, audioFormat != null ? audioFormat : AudioFormat.WAV);