diff --git a/src/Encoder/Encoder.php b/src/Encoder/Encoder.php index c363953..72ee91f 100644 --- a/src/Encoder/Encoder.php +++ b/src/Encoder/Encoder.php @@ -222,7 +222,7 @@ private static function isOnlyDoubleByteKanji(string $content) : bool } for ($i = 0; $i < $length; $i += 2) { - $byte = ord($bytes[$i]) & 0xff; + $byte = ord($bytes[$i]); if (($byte < 0x81 || $byte > 0x9f) && $byte < 0xe0 || $byte > 0xeb) { return false; @@ -457,7 +457,7 @@ private static function generateEcBytes(SplFixedArray $dataBytes, int $numEcByte $toEncode = new SplFixedArray($numDataBytes + $numEcBytesInBlock); for ($i = 0; $i < $numDataBytes; $i++) { - $toEncode[$i] = $dataBytes[$i] & 0xff; + $toEncode[$i] = $dataBytes[$i]; } $ecBytes = new SplFixedArray($numEcBytesInBlock); @@ -649,8 +649,8 @@ private static function appendKanjiBytes(string $content, BitArray $bits) : void $length = strlen($bytes); for ($i = 0; $i < $length; $i += 2) { - $byte1 = ord($bytes[$i]) & 0xff; - $byte2 = ord($bytes[$i + 1]) & 0xff; + $byte1 = ord($bytes[$i]); + $byte2 = ord($bytes[$i + 1]); $code = ($byte1 << 8) | $byte2; if ($code >= 0x8140 && $code <= 0x9ffc) {