src/Writer/BaseWriter.php
public function utf8ToUtf16BigEndian($str, $setbom = true) // UTF8ToUTF16BE
	{
		if ($this->mpdf->checkSIP && preg_match("/([\x{20000}-\x{2FFFF}])/u", $str)) {
			if (!in_array($this->mpdf->currentfontfamily, ['gb', 'big5', 'sjis', 'uhc', 'gbB', 'big5B', 'sjisB', 'uhcB', 'gbI', 'big5I', 'sjisI', 'uhcI',
				'gbBI', 'big5BI', 'sjisBI', 'uhcBI'])) {
				$str = preg_replace("/[\x{20000}-\x{2FFFF}]/u", chr(0), $str);
			}
		}
		if ($this->mpdf->checkSMP && preg_match("/([\x{10000}-\x{1FFFF}])/u", $str)) {
			$str = preg_replace("/[\x{10000}-\x{1FFFF}]/u", chr(0), $str);
		}

		$outstr = ''; // string to be returned
		if ($setbom) {
			$outstr .= "\xFE\xFF"; // Byte Order Mark (BOM)
		}

		$outstr .= mb_convert_encoding($str, 'UTF-16BE', 'UTF-8');

		return $outstr;
	}
public function utf8ToUtf16BigEndian($str, $setbom = true) // UTF8ToUTF16BE
	{
		if ($this->mpdf->checkSIP && preg_match("/([\x{20000}-\x{2FFFF}])/u", $str)) {
			if (!in_array($this->mpdf->currentfontfamily, ['gb', 'big5', 'sjis', 'uhc', 'gbB', 'big5B', 'sjisB', 'uhcB', 'gbI', 'big5I', 'sjisI', 'uhcI',
				'gbBI', 'big5BI', 'sjisBI', 'uhcBI'])) {
				$str = preg_replace("/[\x{20000}-\x{2FFFF}]/u", chr(0), $str);
			}
		}
		if ($this->mpdf->checkSMP && preg_match("/([\x{10000}-\x{1FFFF}])/u", $str)) {
			$str = preg_replace("/[\x{10000}-\x{1FFFF}]/u", chr(0), $str);
		}

		$outstr = ''; // string to be returned
		if ($setbom) {
			$outstr .= "\xFE\xFF"; // Byte Order Mark (BOM)
		}

		$outstr .= mb_convert_encoding($str, 'UTF-16BE', 'UTF-8');

		return $outstr;
	}
public function utf8ToUtf16BigEndian ( $ str , $ setbom = true ) // UTF8ToUTF16BE { if ( $ this -> mpdf -> checkSIP && preg_match ( "/([\x{20000}-\x{2FFFF}])/u" , $ str ) ) { if ( ! in_array ( $ this -> mpdf -> currentfontfamily , [ 'gb' , 'big5' , 'sjis' , 'uhc' , 'gbB' , 'big5B' , 'sjisB' , 'uhcB' , 'gbI' , 'big5I' , 'sjisI' , 'uhcI' , 'gbBI' , 'big5BI' , 'sjisBI' , 'uhcBI' ] ) ) { $ str = preg_replace ( "/[\x{20000}-\x{2FFFF}]/u" , chr ( 0 ) , $ str ) ; } } if ( $ this -> mpdf -> checkSMP && preg_match ( "/([\x{10000}-\x{1FFFF}])/u" , $ str ) ) { $ str = preg_replace ( "/[\x{10000}-\x{1FFFF}]/u" , chr ( 0 ) , $ str ) ; } $ outstr = '' ; // string to be returned if ( $ setbom ) { $ outstr .= "\xFE\xFF" ; // Byte Order Mark (BOM) } $ outstr .= mb_convert_encoding ( $ str , 'UTF-16BE' , 'UTF-8' ) ; return $ outstr ; }
Converts UTF-8 strings to UTF16-BE.
Converts UTF - 8 strings to UTF16 - BE .