Greetings to all,
I am currently working on a chatbot application in Flutter and I have encountered an issue with the encoding of the response received from the OpenAI API. Despite using HTTP requests, some characters, such as ‘é, à, où, …’, are being displayed incorrectly. I have attempted to resolve this issue by adding the ‘charset=UTF-8’ parameter in the API configuration, but the result remains the same.
What to you mean precisely above?
Displayed where? On an HTML page? In the terminal?
For a French response, instead of “célébrité”, “répondre à”. I get “cÃ © lÃ¨brÃ¨bres”, “rÃ © pondre Ã”.
DIsplayed in my terminal, i’m using the last version of Powershell, i don’t think the terminal doest not support. And please excuse if my English or my words are not clear in advance.
I’m having the same kinds of problems. It looks like there are often incorrectly encoded characters in the data sent back from the API, perhaps due to mixing together bits of text from different sources with slightly different or inconsistent encodings?
thank you all for helping me. I solved my problem. The solution was a “response.bodyBytes” instead to “response.body”. bodyBytes is utf-8 encoded, so just decode it and access the message content.
In dart you can resolve this with
But I agree that for me it used to work all the time with a raw response from openapi directly encoded in utf8…
Thanks, this solved my problem.
I search Google & OpenAI API (python) but could not find the response.bodyBytes, could you share the details how to fix this problem?