Share via

TTS Rejecting Certain Characters

SB-1234 10 Reputation points
2023-07-26T21:59:01.0266667+00:00

I've noticed that words are rejected (error 400) like this example:

Курица - rejected because all of the letters are cyrillic (unicode)

Курицa - allowed because the 'a' is ascii

Is there an unwritten rule somewhere? How should I TTS phrases that are entirely non-ascii?

My headers etc are properly formed, I only spotted this when I noticed certain results failing

Foundry Tools
Foundry Tools

Formerly known as Azure AI Services or Azure Cognitive Services is a unified collection of prebuilt AI capabilities within the Microsoft Foundry platform


1 answer

Sort by: Most helpful
  1. SB-1234 10 Reputation points
    2023-09-02T21:40:47.8666667+00:00

    I've fixed the problem, it's actually a bug in Python's requests module. The content-length was miscalculated, and it seems to be optional for TTS

    I remove the content-length like so, and now everything works:

        session = requests.Session()
        request = requests.Request('POST', url=api_endpoint, headers=headers, data=data)
        prepped_request = request.prepare()
    
        del prepped_request.headers['Content-Length']
    
        response = session.send(prepped_request)
    
    1 person found this answer helpful.
    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.