Skip to content

Commit

Permalink
add url encoding to text in synthesize
Browse files Browse the repository at this point in the history
  • Loading branch information
blakesteve committed Mar 14, 2017
1 parent 4cf2760 commit 7d9bbd7
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -215,9 +212,10 @@ public ServiceCall<InputStream> 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);

Expand Down

0 comments on commit 7d9bbd7

Please sign in to comment.