Bug #79213 [Com]: mb_check_encoding doesn't work with base64

From: Date: Sun, 02 Feb 2020 22:05:05 +0000
Subject: Bug #79213 [Com]: mb_check_encoding doesn't work with base64
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225309@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79213&edit=1

 ID:                 79213
 Comment by:         bugreports at gmail dot com
 Reported by:        info at ioweb dot gr
 Summary:            mb_check_encoding doesn't work with base64
 Status:             Open
 Type:               Bug
 Package:            Unknown/Other Function
 Operating System:   Debian 9, Ubuntu 18.04
 PHP Version:        7.2.27
 Block user comment: N
 Private report:     N

 New Comment:

why do you expect base64 strings to be detected as whatever multibyte encoding?

it's a plain string - not more and not less and "BASE64" is not a multibyte encoding
at all


Previous Comments:
------------------------------------------------------------------------
[2020-02-02 21:54:05] info at ioweb dot gr

Description:
------------
mb_check_encoding is unable to detect strings that are encoded with base64, it will show false

Example string "test" will yield "dGVzdA=="

but mb_check_encoding fails to detect correctly this is a base64 encoded string



Test script:
---------------
$base64encoded = base64_encode("test");
$valid = mb_check_encoding($base64encoded, "BASE64");


Expected result:
----------------
$valid is true

Actual result:
--------------
$valid is false


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=79213&edit=1


Thread (13 messages)

« previous php.bugs (#225309) next »