|
@@ -14,7 +14,7 @@ namespace chillerlan\QRCode\Data;
|
|
|
use chillerlan\QRCode\Common\{BitBuffer, Mode};
|
|
use chillerlan\QRCode\Common\{BitBuffer, Mode};
|
|
|
use Throwable;
|
|
use Throwable;
|
|
|
use function chr, implode, intdiv, is_string, mb_convert_encoding, mb_detect_encoding,
|
|
use function chr, implode, intdiv, is_string, mb_convert_encoding, mb_detect_encoding,
|
|
|
- mb_detect_order, mb_internal_encoding, mb_strlen, ord, sprintf, strlen;
|
|
|
|
|
|
|
+ mb_internal_encoding, mb_strlen, ord, sprintf, strlen;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* Hanzi (simplified Chinese) mode, GBT18284-2000: 13-bit double-byte characters from the GB2312/GB18030 character set
|
|
* Hanzi (simplified Chinese) mode, GBT18284-2000: 13-bit double-byte characters from the GB2312/GB18030 character set
|
|
@@ -55,9 +55,12 @@ final class Hanzi extends QRDataModeAbstract{
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public static function convertEncoding(string $string):string{
|
|
public static function convertEncoding(string $string):string{
|
|
|
- mb_detect_order([mb_internal_encoding(), 'UTF-8', 'GB2312', 'GB18030', 'CP936', 'EUC-CN', 'HZ']);
|
|
|
|
|
|
|
|
|
|
- $detected = mb_detect_encoding($string, null, true);
|
|
|
|
|
|
|
+ $detected = mb_detect_encoding(
|
|
|
|
|
+ $string,
|
|
|
|
|
+ [mb_internal_encoding(), 'UTF-8', 'GB2312', 'GB18030', 'CP936', 'EUC-CN', 'HZ'],
|
|
|
|
|
+ true,
|
|
|
|
|
+ );
|
|
|
|
|
|
|
|
if($detected === false){
|
|
if($detected === false){
|
|
|
throw new QRCodeDataException('mb_detect_encoding error');
|
|
throw new QRCodeDataException('mb_detect_encoding error');
|