Weird characters in-between chat API response 😭


Please how can I resolved this, I don’t know what those wired characters are…

And my response can’t return emojis…

This is a contradiction:

image

Is your question about the API or ChatGPT? Those are two distinct products.

Can you please share all prompts including your ā€œsystemā€ prompt?

2 Likes

API sir…

I used the Chat completion API (gt4o) model.. the response given back to me in my app contains those wired symbols..

The prompt I used is ā€œwrite an email about this topic: [users_imput]ā€

1 Like

I’d check your encoding…

  • Encoding Mismatch: The API responses are typically encoded in UTF-8. If your application or environment expects a different encoding (like ISO-8859-1), it can misinterpret the byte sequences, leading to garbled characters.​
  • Streaming Responses: When handling streaming responses, improper decoding of the byte stream can result in partial or incorrect character representations.
3 Likes

Yes: it is encoding. You need to support Unicode UTF-8 multi-byte rendering.

The particular case seen is likely directional single-quotes, like those enclosing ā€˜this’ word.

Still, there’s a bunch of unwanted junk in what should be Latin characters or low-ASCII only, here in O4-mini

You can hit some of the tokens with logit_bias on some models, such as discouraging bytes 128-254 a bit (when individual bit tokens signal a start of multi-byte sequences, up to four bytes in UTF-8. However, that API parameter is now completely unsupported on the Responses endpoint, and also completely ignored and broken if using either top-p or temperature. It used to work on o1-preview, but then they blocked logit_bias even there.

2 Likes

Thank you so much for the response :folded_hands:
I use fluttflow by the way as my environment, just gotta check the documentation about it…


I found something useful in the documentation, so which one is it in the list???

I’m not familiar with Flutterflow, but I would imagine ā€œDecode Responses as UTF-8ā€ being on is what you want.

Did you give it a try?

Might try googling to see if there’s something on the Flutterflow side?

Good luck, and let us know!

2 Likes

Bro it’s works :clap::clap::clap::folded_hands::folded_hands::sob::sob: am so happy and glad right now, thank you so much, I just finished testing it out..

It’s literally nots showing those strange characters again… Thanks man :handshake:

5 Likes

Nice. Happy coding!

2 Likes