diff --git a/src/Stringy.php b/src/Stringy.php index 9c379f6..6a80463 100644 --- a/src/Stringy.php +++ b/src/Stringy.php @@ -488,6 +488,8 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess $str = str_replace($value, $key, $str); } + $str = preg_replace('/[^\x20-\x7E]/u', '', $str); + return self::create($str, $this->encoding); } diff --git a/tests/CommonTest.php b/tests/CommonTest.php index e30b293..7607bf0 100644 --- a/tests/CommonTest.php +++ b/tests/CommonTest.php @@ -174,10 +174,11 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase return array( array('foo bar', 'fòô bàř'), array(' TEST ', ' ŤÉŚŢ '), - array('φ = z = 3', 'φ = ź = 3'), + array(' = z = 3', 'φ = ź = 3'), array('perevirka', 'перевірка'), array('lysaya gora', 'лысая гора'), - array('shchuka', 'щука') + array('shchuka', 'щука'), + array('', '漢字') ); }