diff --git a/lib/Encoding/GenericEncoding.php b/lib/Encoding/GenericEncoding.php index ffb38da..ec4631d 100644 --- a/lib/Encoding/GenericEncoding.php +++ b/lib/Encoding/GenericEncoding.php @@ -15,6 +15,7 @@ trait GenericEncoding { protected $dirtyEOF = 0; protected $errMode = self::MODE_REPLACE; protected $allowSurrogates = false; + protected $selfSynchronizing = false; public $posErr = 0; diff --git a/lib/Encoding/SingleByteEncoding.php b/lib/Encoding/SingleByteEncoding.php index 19a868c..8586671 100644 --- a/lib/Encoding/SingleByteEncoding.php +++ b/lib/Encoding/SingleByteEncoding.php @@ -9,6 +9,8 @@ namespace MensBeam\Intl\Encoding; abstract class SingleByteEncoding implements StatelessEncoding { use GenericEncoding; + protected $selfSynchronizing = true; + public function nextChar(): string { // get the byte at the current position $b = @$this->string[$this->posChar]; diff --git a/lib/Encoding/UTF16.php b/lib/Encoding/UTF16.php index 5bf0b01..5a49fa7 100644 --- a/lib/Encoding/UTF16.php +++ b/lib/Encoding/UTF16.php @@ -9,6 +9,8 @@ namespace MensBeam\Intl\Encoding; abstract class UTF16 implements Encoding { use GenericEncoding; + protected $selfSynchronizing = true; + public function nextCode() { $lead_b = null; $lead_s = null; diff --git a/lib/Encoding/UTF8.php b/lib/Encoding/UTF8.php index 3b7835c..bc15897 100644 --- a/lib/Encoding/UTF8.php +++ b/lib/Encoding/UTF8.php @@ -12,6 +12,8 @@ class UTF8 implements StatelessEncoding { const NAME = "UTF-8"; const LABELS = ["unicode-1-1-utf-8", "utf-8", "utf8"]; + protected $selfSynchronizing = true; + public function nextCode() { // this function effectively implements https://encoding.spec.whatwg.org/#utf-8-decoder // optimization for ASCII characters