diff --git a/src/Filters/NBSPDoubleEncode.php b/src/Filters/NBSPDoubleEncode.php new file mode 100644 index 0000000..07329fe --- /dev/null +++ b/src/Filters/NBSPDoubleEncode.php @@ -0,0 +1,17 @@ +addLast( new RestoreTabsPlaceholders() ); $channel->addLast( new HtmlPlainTextDecoder() ); $channel->addLast( new LtGtDoubleEncode() ); + $channel->addLast( new NBSPDoubleEncode() ); $channel->addLast( new LtGtEncode() ); $channel->addLast( new DataRefReplace() ); diff --git a/tests/MateCatSubFilteringTest.php b/tests/MateCatSubFilteringTest.php index cfa265f..f9f6433 100644 --- a/tests/MateCatSubFilteringTest.php +++ b/tests/MateCatSubFilteringTest.php @@ -273,6 +273,16 @@ public function testNbsp() { $this->assertEquals( $string_from_UI, $filter->fromLayer0ToLayer2( $expected_segment ) ); } + public function testNbspAsString() { + $filter = $this->getFilterInstance(); + + $expected_segment = '  Text'; + $string_from_UI = '  Text'; + + $this->assertEquals( $expected_segment, $filter->fromLayer2ToLayer0( $string_from_UI ) ); + $this->assertEquals( $string_from_UI, $filter->fromLayer0ToLayer2( $expected_segment ) ); + } + /** ************************** * Sprintf