Skip to content

Conversation

aleksandar-mitrev
Copy link
Contributor

@aleksandar-mitrev aleksandar-mitrev commented Jul 9, 2025

What:

  • Bug Fix
  • New Feature

Description:

This PR fixes a bug where non-ASCII characters (e.g., German umlauts like ü and Ö) were being incorrectly escaped in the JSON request body (e.g., to \u00fc and \u00d6).

Related:

How to Test

  1. Create a request with parameters containing special UTF-8 characters. For example:
    $client->chat()->create([
        'model' => 'gpt-4o',
        'messages' => [
            ['role' => 'user', 'content' => 'Was bedeuten die Umlaute ü und Ö?'],
        ],
    ]);

Intercept the request body before it is sent.

Before this fix: The body would contain "... \u00fc und \u00d6".

After this fix: The body now correctly contains "... ü und Ö".

Copy link
Collaborator

@iBotPeaches iBotPeaches left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me. I'll do some quick tests with OpenAI with escaped and unescaped to double check how AI handles the difference.

@iBotPeaches iBotPeaches merged commit 3cc12b5 into openai-php:main Jul 9, 2025
12 checks passed
@iBotPeaches
Copy link
Collaborator

thanks! my tests worked

@iBotPeaches iBotPeaches added this to the v0.15.0 milestone Jul 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants