mb_check_encoding is detecting SJIS as Windows-1252 in PHP 8.1
Đang mở
@alexdowad đang làm issue này rồi.
Từ ngày 22/3/2024.
Bug
Extension: mbstring
Status: Needs Triage
- Ngôn ngữ chính
- C
- Star
- 40.4k
- Fork
- 8.2k
- Merge trung bình
- 2 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 103
Mô tả
Description
Works as expected in 7.4
The following code:
<?php
$string = mb_convert_encoding('パーティーへ行かないか', 'SJIS', 'UTF-8');
var_dump(mb_check_encoding($string, 'SJIS')); // should be valid
var_dump(mb_check_encoding($string, 'Windows-1252')); // should be invalid
var_dump(mb_detect_encoding($string, 'SJIS', true)); // should be valid
var_dump(mb_detect_encoding($string, 'Windows-1252', true)); // should be invalid
var_dump(mb_convert_encoding($string, 'UTF-8', 'SJIS')); // should be correct
var_dump(mb_convert_encoding($string, 'UTF-8', 'Windows-1252')); // should be wrong
Resulted in this output:
bool(true)
bool(true)
string(4) "SJIS"
string(12) "Windows-1252"
string(33) "パーティーへ行かないか"
string(43) "ƒp[ƒeƒB[‚Ös‚©‚È‚¢‚©"
But I expected this output instead:
bool(true)
bool(false)
string(4) "SJIS"
bool(false)
string(33) "パーティーへ行かないか"
string(46) "ƒp�[ƒeƒB�[‚Ö�s‚©‚È‚¢‚©"
PHP Version
PHP 8.1.27
Operating System
CentOS 7
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Đánh giá
Issue này chưa được đánh giá.