Skip to content

Can't handle Arabic. #1031

@hopeseekr

Description

@hopeseekr

Describe the bug

The package needs JSON_UNESCAPED_UNICODE.

Installed packages

0.0.0/composer-include-files        1.6.1   Include files at a higher priority than autoload files. Useful fo...
autonomo/ai-speaker                 1.0.0   A quick and easy extension for effortlessly handling many LLM APIs
beste/clock                         3.0.0   A collection of Clock implementations
beste/in-memory-cache               1.4.0   A PSR-6 In-Memory cache that can be used as a fallback implementa...
beste/json                          1.7.0   A simple JSON helper to decode and encode JSON
brick/math                          0.14.0  Arbitrary-precision arithmetic library
carbonphp/carbon-doctrine-types     3.2.0   Types to use Carbon in Doctrine
doctrine/inflector                  2.1.0   PHP Doctrine Inflector is a small library that can perform string...
fig/http-message-util               1.1.5   Utility classes and constants for use with PSR-7 (psr/http-message)
firebase/php-jwt                    6.11.1  A simple library to encode and decode JSON Web Tokens (JWT) in PH...
giggsey/libphonenumber-for-php-lite 9.0.17  A lite version of giggsey/libphonenumber-for-php, which is a PHP ...
google/auth                         1.44.0  Google Auth Library for PHP
google/cloud-core                   1.60.0  Google Cloud PHP shared dependency, providing functionality usefu...
google/cloud-storage                1.48.6  Cloud Storage Client for PHP
google/common-protos                4.12.4  Google API Common Protos for PHP
google/gax                          1.35.1  Google API Core for PHP
google/grpc-gcp                     0.4.1   gRPC GCP library for channel management
google/longrunning                  0.6.0   Google LongRunning Client for PHP
google/protobuf                     4.33.0  proto library for PHP
graham-campbell/result-type         1.1.3   An Implementation Of The Result Type
grpc/grpc                           1.74.0  gRPC library for PHP
guzzlehttp/guzzle                   7.10.0  Guzzle is a PHP HTTP client library
guzzlehttp/promises                 2.3.0   Guzzle promises library
guzzlehttp/psr7                     2.8.0   PSR-7 message implementation that also provides common utility me...
illuminate/bus                      11.46.1 The Illuminate Bus package.
illuminate/collections              11.46.1 The Illuminate Collections package.
illuminate/conditionable            11.46.1 The Illuminate Conditionable package.
illuminate/container                11.46.1 The Illuminate Container package.
illuminate/contracts                11.46.1 The Illuminate Contracts package.
illuminate/database                 11.46.1 The Illuminate Database package.
illuminate/events                   11.46.1 The Illuminate Events package.
illuminate/filesystem               11.46.1 The Illuminate Filesystem package.
illuminate/macroable                11.46.1 The Illuminate Macroable package.
illuminate/pipeline                 11.46.1 The Illuminate Pipeline package.
illuminate/support                  11.46.1 The Illuminate Support package.
kreait/firebase-php                 7.16.0  Firebase Admin SDK
kreait/firebase-tokens              5.3.0   A library to work with Firebase tokens
laravel/serializable-closure        2.0.6   Laravel Serializable Closure provides an easy and secure way to s...
lcobucci/jwt                        5.6.0   A simple library to work with JSON Web Token and JSON Web Signature
minicli/minicli                     4.2.0.2 Experimental micro CLI framework for PHP
monolog/monolog                     2.10.0  Sends your logs to files, sockets, inboxes, databases and various...
mtdowling/jmespath.php              2.8.0   Declaratively specify how to extract elements from a JSON document
nesbot/carbon                       3.10.3  An API extension for DateTime that supports 281 different languages.
nstwf/extended-reflection-class     1.2.2   Extended reflection class
pecee/simple-router                 5.4.1.7 Simple, fast PHP router that is easy to get integrated and in alm...
phpexperts/console-painter          1.1.0   A quick and easy library for colorizing and stylizing ANSI consoles.
phpexperts/datatype-validator       3.1.0   An easy to use data type validator (both strict and fuzzy).
phpexperts/laravel-env-polyfill     1.7.0   Use Laravel's pre-5.8 env() function in your non-Laravel projects.
phpexperts/rest-speaker             2.8.0   A quick and easy GuzzleHTTP extension for effortlessly handling R...
phpexperts/simple-dto               3.9.1   A quick and easy DTO package.
phpoption/phpoption                 1.9.4   Option Type for PHP
psr/cache                           3.0.0   Common interface for caching libraries
psr/clock                           1.0.0   Common interface for reading the clock.
psr/container                       2.0.2   Common Container Interface (PHP FIG PSR-11)
psr/http-client                     1.0.3   Common interface for HTTP clients
psr/http-factory                    1.1.0   PSR-17: Common interfaces for PSR-7 HTTP message factories
psr/http-message                    2.0     Common interface for HTTP messages
psr/log                             1.1.4   Common interface for logging libraries
psr/simple-cache                    3.0.0   Common interfaces for simple caching
ralouphie/getallheaders             3.0.3   A polyfill for getallheaders.
ramsey/collection                   2.1.1   A PHP library for representing and manipulating collections.
ramsey/uuid                         4.9.1   A PHP library for generating and working with universally unique ...
rize/uri-template                   0.4.0   PHP URI Template (RFC 6570) supports both expansion & extraction
symfony/clock                       7.3.0   Decouples applications from the system clock
symfony/deprecation-contracts       3.6.0   A generic function and convention to trigger deprecation notices
symfony/finder                      7.3.2   Finds files and directories via an intuitive fluent interface
symfony/polyfill-ctype              1.33.0  Symfony polyfill for ctype functions
symfony/polyfill-mbstring           1.33.0  Symfony polyfill for the Mbstring extension
symfony/polyfill-php80              1.33.0  Symfony polyfill backporting some PHP 8.0+ features to lower PHP ...
symfony/polyfill-php83              1.33.0  Symfony polyfill backporting some PHP 8.3+ features to lower PHP ...
symfony/translation                 7.3.4   Provides tools to internationalize your application
symfony/translation-contracts       3.6.0   Generic abstractions related to translation
symfony/var-dumper                  7.3.4   Provides mechanisms for walking through any arbitrary PHP variable
vlucas/phpdotenv                    5.6.2   Loads environment variables from `.env` to `getenv()`, `$_ENV` an...
voku/portable-ascii                 2.0.3   Portable ASCII library - performance optimized (ascii) string fun...

PHP version and extensions

composer               2.8.12   Composer package
composer-plugin-api    2.6.0    The Composer Plugin API
composer-runtime-api   2.2.2    The Composer Runtime API
ext-bcmath             8.4.14   The bcmath PHP extension
ext-calendar           8.4.14   The calendar PHP extension
ext-ctype              8.4.14   The ctype PHP extension
ext-curl               8.4.14   The curl PHP extension
ext-date               8.4.14   The date PHP extension
ext-dom                20031129 The dom PHP extension
ext-exif               8.4.14   The exif PHP extension
ext-ffi                8.4.14   The FFI PHP extension
ext-fileinfo           8.4.14   The fileinfo PHP extension
ext-filter             8.4.14   The filter PHP extension
ext-gd                 8.4.14   The gd PHP extension
ext-gettext            8.4.14   The gettext PHP extension
ext-gmp                8.4.14   The gmp PHP extension
ext-hash               8.4.14   The hash PHP extension
ext-iconv              8.4.14   The iconv PHP extension
ext-intl               8.4.14   The intl PHP extension
ext-json               8.4.14   The json PHP extension
ext-libxml             8.4.14   The libxml PHP extension
ext-mbstring           8.4.14   The mbstring PHP extension
ext-mysqli             8.4.14   The mysqli PHP extension
ext-mysqlnd            0        The mysqlnd PHP extension (actual version: mysqlnd 8.4.14)
ext-openssl            8.4.14   The openssl PHP extension
ext-pcntl              8.4.14   The pcntl PHP extension
ext-pcre               8.4.14   The pcre PHP extension
ext-pdo                8.4.14   The PDO PHP extension
ext-pdo_mysql          8.4.14   The pdo_mysql PHP extension
ext-pdo_pgsql          8.4.14   The pdo_pgsql PHP extension
ext-pdo_sqlite         8.4.14   The pdo_sqlite PHP extension
ext-pgsql              8.4.14   The pgsql PHP extension
ext-phar               8.4.14   The Phar PHP extension
ext-posix              8.4.14   The posix PHP extension
ext-random             8.4.14   The random PHP extension
ext-readline           8.4.14   The readline PHP extension
ext-reflection         8.4.14   The Reflection PHP extension
ext-session            8.4.14   The session PHP extension
ext-simplexml          8.4.14   The SimpleXML PHP extension
ext-snmp               8.4.14   The snmp PHP extension
ext-soap               8.4.14   The soap PHP extension
ext-sockets            8.4.14   The sockets PHP extension
ext-sodium             8.4.14   The sodium PHP extension
ext-spl                8.4.14   The SPL PHP extension
ext-sqlite3            8.4.14   The sqlite3 PHP extension
ext-tokenizer          8.4.14   The tokenizer PHP extension
ext-xdebug             3.4.5    The xdebug PHP extension
ext-xml                8.4.14   The xml PHP extension
ext-xmlreader          8.4.14   The xmlreader PHP extension
ext-xmlwriter          8.4.14   The xmlwriter PHP extension
ext-zend-opcache       8.4.14   The Zend OPcache PHP extension
ext-zip                1.22.7   The zip PHP extension
ext-zlib               8.4.14   The zlib PHP extension
lib-curl               8.16.0   The curl library
lib-curl-libssh2       1.11.1   curl libssh2 version
lib-curl-openssl       3.6.0    curl OpenSSL version (3.6.0)
lib-date-timelib       2022.14  date timelib version
lib-date-zoneinfo      2025.2   zoneinfo ("Olson") database for date
lib-fileinfo-libmagic  545      fileinfo libmagic version
lib-gd                 2.3.3    The gd library
lib-gmp                6.3.0    The gmp library
lib-iconv              2.42     The iconv library
lib-icu                76.1     The ICU unicode and globalization support library
lib-icu-cldr           46       ICU CLDR project version
lib-icu-unicode        16.0.0   ICU unicode version
lib-icu-zoneinfo       2024.2   zoneinfo ("Olson") database for icu
lib-libsodium          1.0.20   The libsodium library
lib-libxml             2.15.1   libxml library version
lib-mbstring-libmbfl   1.3.2    mbstring libmbfl version
lib-mbstring-oniguruma 6.9.10   mbstring oniguruma version
lib-openssl            3.6.0    OpenSSL 3.6.0 1 Oct 2025
lib-pcre               10.47    The pcre library
lib-pcre-unicode       16.0.0   PCRE Unicode version support
lib-pdo_pgsql-libpq    18.0     libpq for pdo_pgsql
lib-pdo_sqlite-sqlite  3.50.4   The pdo_sqlite-sqlite library
lib-pgsql-libpq        18.0     libpq for pgsql
lib-sqlite3-sqlite     3.50.4   The sqlite3-sqlite library
lib-zip-libzip         1.11.4   The zip-libzip library
php                    8.4.14   The PHP interpreter
php-64bit              8.4.14   The PHP interpreter, 64bit
php-ipv6               8.4.14   The PHP interpreter, with IPv6 support

Steps to reproduce the issue.

use Kreait\Firebase\Database;

class FirebaseTicketService
{
    private Database $database;

    public function addConversationMessage(string $ticketId, string $role, string $content): void
    {
        $ticketRef = $this->database->getReference('tickets/' . $ticketId);
        if (!$snapshot->exists()) {
            throw new RuntimeException("Ticket {$ticketId} does not exist.");
        }

        $ticket = $snapshot->getValue();
        $ticket['conversation'][] = [
            'role' => $role,
            'content' => 'لقد تعطل',
            'timestamp' => (new \DateTimeImmutable())->format(DateTimeInterface::ATOM),
        ];

        $ticketRef->set($ticket);
    }
}

Error message/Stack trace

json_encode error: Malformed UTF-8 characters, possibly incorrectly encoded

#0 /var/www/api.autonomo.codes/vendor/kreait/firebase-php/src/Firebase/Database/ApiClient.php(164): Kreait\Firebase\Exception\DatabaseApiExceptionConverter->convertException()
#1 /var/www/api.autonomo.codes/vendor/kreait/firebase-php/src/Firebase/Database/ApiClient.php(68): Kreait\Firebase\Database\ApiClient->requestApi()
#2 /var/www/api.autonomo.codes/vendor/kreait/firebase-php/src/Firebase/Database/Reference.php(284): Kreait\Firebase\Database\ApiClient->set()
#3 /var/www/api.autonomo.codes/src/WAHA/Services/FirebaseTicketService.php(107): Kreait\Firebase\Database\Reference->set()
#4 /var/www/api.autonomo.codes/src/WAHA/Controllers/WhatsAppWebhookController.php(199): Autonomo\API\WAHA\Services\FirebaseTicketService->addConversationMessage()
#5 [internal function]: Autonomo\API\WAHA\Controllers\WhatsAppWebhookController->handle()

Additional information

Also occurs in Chinese, Japanese, and Hindi and probably any other non-Latin language.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions