1

In IBM's documentation for text-to-speech feature there is an example of adding words to Japanese custom model:

Adding words to a Japanese custom model

They say the following:

The following examples of the PUT /v1/customizations/{customization_id}/words/{word} method translate the URL-encoded, double-byte string for NY to the noun (Mesi) ニューヨーク (New York in English). If this custom translation is not defined, the string is read as enu wai.

And provided example:

curl -X PUT -u "apikey:{apikey}" --header "Content-Type: application/json" --data "{\"translation\":\"ニューヨーク\", \"part_of_speech\":\"Mesi\"}" "https://stream.watsonplatform.net/text-to-speech/api/v1/customizations/{customization_id}/words/%EF%BC%AE%EF%BC%B9"

The question is: How to convert a string to its double-byte representation (nodejs)?

I was playing with https://www.urldecoder.org/ but wasn't able to determine correct encoding... :(

stedejan
  • 145
  • 1
  • 2
  • 9
  • I've found solution here: [https://stackoverflow.com/questions/20486551/javascript-function-to-convert-utf8-string-between-fullwidth-and-halfwidth-forms](https://stackoverflow.com/questions/20486551/javascript-function-to-convert-utf8-string-between-fullwidth-and-halfwidth-forms) – stedejan May 24 '19 at 06:18

0 Answers0