IBM Watson double-byte string conversion

58 Views Asked by At

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... :(

0

There are 0 best solutions below