Skip to content

The return value of mb_list_encodings() doesn't contain 'SJIS-win' #8308

Closed
@sji-il

Description

@sji-il

Description

The following code:

<?php
var_dump(mb_list_encodings());

https://3v4l.org/GH0Gj

Resulted in this output:

  • contains 'CP932' and 'SJIS', but no 'SJIS-win'

But I expected this output instead:

  • contains 'SJIS-win'

As of PHP 8.1, SJIS-win is an alias of CP932, thus the return value of mb_list_encodings() doesn't contain 'SJIS-win'.

This breaks BC.

Some libraries have functions which receive one or more encoding names as arguments, and they often validate the input by the return value of mb_list_encodings().
This should be reverted, or fixed, or at least documented as an incompatible change.

PHP Version

PHP 8.1.0

Operating System

No response

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