Преглед на файлове

:octocat: detect source encoding

codemasher преди 5 години
родител
ревизия
81dcab5b66
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      src/QRCode.php

+ 2 - 2
src/QRCode.php

@@ -18,7 +18,7 @@ use chillerlan\QRCode\Data\{
 use chillerlan\QRCode\Common\{ECICharset, MaskPattern, Mode};
 use chillerlan\QRCode\Output\{QRCodeOutputException, QRFpdf, QRImage, QRImagick, QRMarkup, QROutputInterface, QRString};
 use chillerlan\Settings\SettingsContainerInterface;
-use function class_exists, in_array, mb_convert_encoding, mb_internal_encoding;
+use function class_exists, in_array, mb_convert_encoding, mb_detect_encoding;
 
 /**
  * Turns a text string into a Model 2 QR Code
@@ -279,7 +279,7 @@ class QRCode{
 		$eciCharsetName = $eciCharset->getName();
 		// convert the string to the given charset
 		if($eciCharsetName !== null){
-			$data = mb_convert_encoding($data, $eciCharsetName, mb_internal_encoding());
+			$data = mb_convert_encoding($data, $eciCharsetName, mb_detect_encoding($data));
 			// add ECI designator
 			$this->addSegment(new ECI($eciCharset->getID()));
 			$this->addSegment(new Byte($data));