mb_convert_encoding

Supported Versions: PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8
Convert a string from one character encoding to another
<?php mb_convert_encoding(array|string $string, string $to_encoding, array|string|null $from_encoding = null): array|string|false
<?php     {

        $failed_at = Date::now();



        $exception = (string) mb_convert_encoding($exception, 'UTF-8');



        return $this->getTable()->insertGetId(compact(

            'connection', 'queue', 'payload', 'exception', 'failed_at'
<?php             'connection' => $connection,

            'queue' => $queue,

            'payload' => $payload,

            'exception' => (string) mb_convert_encoding($exception, 'UTF-8'),

            'failed_at' => Date::now(),

        ]);
<?php                 'connection' => $connection,

                'queue' => $queue,

                'payload' => $payload,

                'exception' => (string) mb_convert_encoding($exception, 'UTF-8'),

                'failed_at' => $failedAt->format('Y-m-d H:i:s'),

                'failed_at_timestamp' => $failedAt->getTimestamp(),

            ]);
<?php         $uuid = Str::uuid();



        $exception = new Exception(mb_convert_encoding('ÐÑÙ0E\xE2\x�98\xA0World��7B¹!þÿ', 'ISO-8859-1', 'UTF-8'));

        $provider = new DatabaseFailedJobProvider($db->getDatabaseManager(), 'default', 'failed_jobs');



        $provider->log('database', 'default', json_encode(['uuid' => (string) $uuid]), $exception);
<?php         $provider->log('database', 'default', json_encode(['uuid' => (string) $uuid]), $exception);



        $exception = (string) mb_convert_encoding($exception, 'UTF-8');



        $this->assertSame(1, $db->getConnection()->table('failed_jobs')->count());

        $this->assertSame($exception, $db->getConnection()->table('failed_jobs')->first()->exception);
<?php                 'connection' => 'connection',

                'queue' => 'queue',

                'payload' => json_encode(['uuid' => $uuid]),

                'exception' => (string) mb_convert_encoding($exception, 'UTF-8'),

                'failed_at' => $failedJobs[0]->failed_at,

                'failed_at_timestamp' => $failedJobs[0]->failed_at_timestamp,

            ],
<?php                 'connection' => 'connection',

                'queue' => 'queue',

                'payload' => json_encode(['uuid' => $uuidTwo]),

                'exception' => (string) mb_convert_encoding($exceptionTwo, 'UTF-8'),

                'failed_at' => $failedJobs[1]->failed_at,

                'failed_at_timestamp' => $failedJobs[1]->failed_at_timestamp,

            ],
<?php                 'connection' => 'connection',

                'queue' => 'queue',

                'payload' => json_encode(['uuid' => $uuidOne]),

                'exception' => (string) mb_convert_encoding($exceptionOne, 'UTF-8'),

                'failed_at' => $failedJobs[0]->failed_at,

                'failed_at_timestamp' => $failedJobs[0]->failed_at_timestamp,

            ],
<?php             'connection' => 'connection',

            'queue' => 'queue',

            'payload' => json_encode(['uuid' => (string) $uuid]),

            'exception' => (string) mb_convert_encoding($exception, 'UTF-8'),

            'failed_at' => $failedJob->failed_at,

            'failed_at_timestamp' => $failedJob->failed_at_timestamp,

        ], $failedJob);
<?php     public function testEWithInvalidCodePoints()

    {

        $str = mb_convert_encoding('føø bar', 'ISO-8859-1', 'UTF-8');

        $this->assertEquals('f�� bar', e($str));

    }
<?php                                 return $match[0];

                            }



                            return str_repeat('\\', $l - 1) . mb_convert_encoding(

                                pack('H*', $match[2]),

                                'UTF-8',

                                'UCS-2BE'

                            );

                        }



                        return $match[0];
<?php         }

        $this->lastDepth = $depth;



        $this->line = mb_convert_encoding($this->line, 'HTML-ENTITIES', 'UTF-8');



        if (-1 === $depth) {

            AbstractDumper::dumpLine(0);
<?php     public function testCharset()

    {

        $var = mb_convert_encoding('Словарь', 'CP1251', 'UTF-8');



        $dumper = new HtmlDumper('php://output', 'CP1251');

        $dumper->setDumpHeader('<foo></foo>');