Skip to content

mb_check_encoding returns true for € and ISO -8859-1 instead of false #19344

@jWeck-Software

Description

@jWeck-Software

Description

The following code:

<?php

$str = '';
var_dump(mb_check_encoding($str, 'ISO-8859-1'));

Resulted in this output:

true

But I expected this output instead:

false

https://en.wikipedia.org/wiki/ISO/IEC_8859-1#:~:text=by%20this%20standard.-,Euro%20sign,-%5Bedit%5D

The euro sign was first presented to the public on 12 December 1996.[13] Due to this character set being introduced in 1987, it does not include the euro sign. Later character sets similar to ISO/IEC 8859-1 include a euro sign, such as Windows-1252 and ISO/IEC 8859-15.

PHP Version

PHP 8.3.23 (cli|fpm) (built: Jul  3 2025 16:10:55) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.23, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.23, Copyright (c), by Zend Technologies

Operating System

Kubuntu 22.04, Ubuntu 24.04, Debian 12

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions