Просмотр исходного кода

:octocat: change mb_internal_encoding() on execution, not invocation

codemasher 5 лет назад
Родитель
Сommit
d85c5ddb5d
1 измененных файлов с 3 добавлено и 2 удалено
  1. 3 2
      src/QRCode.php

+ 3 - 2
src/QRCode.php

@@ -177,8 +177,6 @@ class QRCode{
 	public function __construct(SettingsContainerInterface $options = null){
 	public function __construct(SettingsContainerInterface $options = null){
 		// save the current mb-encoding (in case it differs from UTF-8)
 		// save the current mb-encoding (in case it differs from UTF-8)
 		$this->mbCurrentEncoding = mb_internal_encoding();
 		$this->mbCurrentEncoding = mb_internal_encoding();
-		// use UTF-8 from here on
-		mb_internal_encoding('UTF-8');
 
 
 		$this->options = $options ?? new QROptions;
 		$this->options = $options ?? new QROptions;
 	}
 	}
@@ -198,6 +196,9 @@ class QRCode{
 	 * @return mixed
 	 * @return mixed
 	 */
 	 */
 	public function render(string $data, string $file = null){
 	public function render(string $data, string $file = null){
+		// use UTF-8 from here on
+		mb_internal_encoding('UTF-8');
+
 		return $this->initOutputInterface($data)->dump($file);
 		return $this->initOutputInterface($data)->dump($file);
 	}
 	}