1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-14 01:04:06 +02:00

Fix toAscii failing to remove remaining non-ascii characters

This commit is contained in:
Daniel St. Jules
2014-04-19 00:49:46 -04:00
parent ae7527ad4a
commit 8fe30d18b7
2 changed files with 5 additions and 2 deletions

View File

@@ -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);
}

View File

@@ -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('', '漢字')
);
}