Skip to content

Commit 2257b0d

Browse files
committed
Fix parsing for multibyte strings
1 parent aae79f6 commit 2257b0d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/HJSON/HJSONParser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ private function next($c = false)
326326

327327
// Get the next character. When there are no more characters,
328328
// return the empty string.
329-
$this->ch = (mb_strlen($this->text) > $this->at) ? $this->text[$this->at] : null;
330-
$this->at++;
329+
$this->ch = (strlen($this->text) > $this->at) ? mb_substr(mb_strcut($this->text, $this->at), 0, 1) : null;
330+
$this->at = $this->at + strlen($this->ch);
331331
return $this->ch;
332332
}
333333

0 commit comments

Comments
 (0)