Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/Encoder/Encoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ private static function appendBytes(string $content, Mode $mode, BitArray $bits,
break;

case Mode::BYTE():
self::append8BitBytes($content, $bits, $encoding);
self::append8BitBytes($content, $bits);
break;

case Mode::KANJI():
Expand Down Expand Up @@ -608,17 +608,9 @@ private static function appendAlphanumericBytes(string $content, BitArray $bits)

/**
* Appends regular 8-bit bytes to a bit array.
*
* @throws WriterException if content cannot be encoded to target encoding
*/
private static function append8BitBytes(string $content, BitArray $bits, string $encoding) : void
private static function append8BitBytes(string $bytes, BitArray $bits) : void
{
$bytes = @iconv('utf-8', $encoding, $content);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could be done only if mbstring is not present ?


if (false === $bytes) {
throw new WriterException('Could not encode content to ' . $encoding);
}

$length = strlen($bytes);

for ($i = 0; $i < $length; $i++) {
Expand Down