IBM Watson Text-to-Speech issue with German umlaute (ä-ö-ü) - ibm-cloud

I have a porblem when I want to export a .wav file.
With the English language i don't have any issues also when i want to export a German sentence without any Umlaute it works fine. But when i want to export something like "Häuschen" I can't open the file and it's also only 1KB big. Do you guys know what could be the problem?
I used the following code on WIN10
curl -X POST -u "apikey:{key}" ^
--header "Content-Type: application/json" ^
--header "Accept: audio/wav" ^
--data "{\"text\":\"Häuschen\"}" ^
--output Haeuschen.wav ^
"{url}/v1/voices/de-DE_ErikaV3Voice/synthesize"

I have tried to reproduce this on MacOs ... I had to replace the ^ with \ to have the correct multi line syntax, but other than that no change to your command.
curl -X POST -u "apikey:{key}" \
--header "Content-Type: application/json" \
--header "Accept: audio/wav" \
--data "{\"text\":\"Häuschen\"}" \
--output Haeuschen.wav \
"{url}/v1/voices/de-DE_ErikaV3Voice/synthesize"
The service returned a playable file that was 45KB big. So even this is not a solution for your problem, this gives you a data point that it should work and you can search for the right way to send this from a Windows machine now.

Related

How to attach docs and import issue at the same time using GitHub API?

I need to import all bug reports and attachments from my internal system to GitHub Issues.
What GitHub API parameter should I use to attach a document in my curl command?
curl -X "POST" \
-H "Accept: application/vnd.github+json" \
-H "Accept: application/vnd.github.VERSION.html" \
-H "Authorization: token <token>" \
https://api.github.com/repos/BT23/demo-repo/issues \
-d '{
"title":"Create an issue in HTML format",
"body":"<H1>Testing HTML tags</H1><P>Does it work?</P>",
"assignee": "BT23",
"milestone": 1,
"labels":["bug", "functional"]
}'
Thanks
I do not see the word file anywhere in Issues API.
And this thread confirms you cannot attach a file during Issue Creation.
Adding a file to issue or pull request seems to be done manually through drag & drop only.

How to add parameters to a GitHub API request via cURL?

I’m trying to access the GitHub API using a cURL request and having trouble adding a couple parameters.
Currently this is working:
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/sspboyd/Presidential_Debates/commits >> output.json
I want to use the page= and per_page=100 parameters as listed here:
https://docs.github.com/en/rest/reference/repos#list-commits
I have tried using ?page=1 and /?page=1 as shown below and neither of these work:
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/sspboyd/Presidential_Debates/commits?page=1 >> output.json
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/sspboyd/Presidential_Debates/commits/?page=1 >> output.json
Is there something I am missing here?
Try
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/sspboyd/Presidential_Debates/commits?page=1"
>> output.json
Note the double quotes on the URL.
I was running into a similar issue with the Github api. I then figured out it was a problem with special characters in the url. In this case the ? is causing the problem.

Azure DevOps problem to create project via REST call containing german umlauts

I have an admin script that creates Azure DevOps projects via calls to the REST API. This works fine as long as the name or description arguments contain no special characters. If for example german umlauts are in the description, the call fails.
This works:
curl -k -D- -X POST -d '{"name":"Phantom","capabilities":{"processTemplate":{"templateTypeId":"6b724908-ef14-45cf-84f8-768b5384da45"},"versioncontrol":{"sourceControlType":"Git"}},"visibility":"private","description":"Innocent description without umlauts"}' -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'Authorization: Basic secretauthorizationtoken=' https://dev.azure.com/AdminPlayground/_apis/projects?api-version=6.0-preview.4
this one throws an exception:
curl -k -D- -X POST -d '{"name":"Phantom","capabilities":{"processTemplate":{"templateTypeId":"6b724908-ef14-45cf-84f8-768b5384da45"},"versioncontrol":{"sourceControlType":"Git"}},"visibility":"private","description":"Funny description with strange äöüß chars"}' -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'Authorization: Basic secretauthorizationtoken=' https://dev.azure.com/AdminPlayground/_apis/projects?api-version=6.0-preview.4
The exception is:
{"$id":"1","innerException":null,"message":"Value cannot be null.\r\nParameter name: projectToCreate","typeName":"System.ArgumentNullException, mscorlib","typeKey":"ArgumentNullException","errorCode":0,"eventId":0}
Has anybody experienced similar behavior, and could perhaps suggest a solution?
Thanks!
This problem is due to the data format problem caused by the special characters in description.
Kindly check if it can be solved by adding the correct encoding format into the -ContentType,
For example -ContentType 'application/json;charset=utf -8'

How to fix this error and what does this error mean in IBM Cloud?

Now I would like to use "Speech to Text" on IBM Cloud to get Japanese text from Speech data, mp3.
However, I have gotten the same error as below after I tried it many times.
<HTML><HEAD>
<TITLE>Internal Server Error</TITLE>
</HEAD><BODY>
<H1>Internal Server Error - Write</H1>
The server encountered an internal error or
misconfiguration and was unable to
complete your request.
And this is my code with curl.
curl -X POST -u "apikey:{apikey}" \
--header "Content-Type: audio/mp3" \
--data-binary #{path_to_file} \
"https://gateway-tok.watsonplatform.net/speech-t
o-text/api/v1/recognize?model=jaJP_BroadbandModel"
You have a typo in the model, it should be ja-JP_BroadbandModel
Try this code
Note that: After the {url} , you must type /v1/recognize
*audio-file.flac is the name of the audio file
curl -X POST -u "apikey:{apikey}" ^
--header "Content-Type: audio/flac" ^
--data-binary #{audio file path}audio-file.flac ^
"{url}/v1/recognize"
Happy coding :)

IBM Watson text-to-speech curl example not working

Here is the command I am using to test the text-to-speech API:
/usr/bin/curl -k -u 'USERNAME':'PASSWORD' -X POST \
--header 'Content-Type: application/json' \
--header 'Accept: audio/wav' \
--data '{"text":"hellow world","voice":"en-US_AllisonVoice"}' \
'https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize' > ./public/138106.wav
The command above doesn't seem to generate the desired audio file. I have a bluemix account and the right credentials. An audio file is generated, but it's corrupt.
voice is a URL parameter. The correct curl command looks like this:
/usr/bin/curl -k -u 'USERNAME':'PASSWORD' -X POST \
--header 'Content-Type: application/json' \
--header 'Accept: audio/wav' \
--data '{"text":"hellow world"}' \
'https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize?voice=en-US_AllisonVoice'
Disclosure: I am an evangelist for IBM Watson.
--data '{"text":"hellow world","voice":"en-US_AllisonVoice"}'
Try this:
--data "{\"text\":\"hello world\", \"voice\":\"en-US_AllisonVoice\"}"
I took this syntax from the API documentation found here: https://www.ibm.com/smarterplanet/us/en/ibmwatson/developercloud/doc/text-to-speech/quick-curl.shtml
It seems they have built the syntax of the JSON differently than your command.
I solved it not using the cURL scripting recommendation.
But by going directly to the url: https://stream.watsonplatform.net/speech-to-text/api/v1/recognize
Then removing the following 2 lines:
"word_alternatives_threshold": null,
"keywords_threshold": null,
There are issues with these lines.