Skip to content

Commit b46f2a1

Browse files
author
Jochen Pfaeffle
committed
fix multicharactor with utf-8 encoding
1 parent d59afa4 commit b46f2a1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/EDI/Parser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ public function parse(): self
157157

158158
// Basic sanitization, remove non-printable chars.
159159
$lineTrim = \trim($line);
160-
$line = (string) \preg_replace($this->stripChars, '', $lineTrim);
160+
if (mb_detect_encoding($line, mb_list_encodings()) !== 'UTF-8') {
161+
$line = (string) \preg_replace($this->stripChars, '', $lineTrim);
162+
}
161163
$line_bytes = \strlen($line);
162164

163165
if ($line_bytes !== \strlen($lineTrim)) {

0 commit comments

Comments
 (0)