1
0
mirror of https://github.com/danielstjules/Stringy.git synced 2025-08-13 00:34:11 +02:00

Merge pull request #66 from vlakoff/nbsp

Support for various Unicode spaces in toAscii()
This commit is contained in:
Daniel St. Jules
2015-01-06 16:38:55 -08:00
2 changed files with 9 additions and 2 deletions

View File

@@ -508,7 +508,9 @@ class Stringy implements \Countable, \IteratorAggregate, \ArrayAccess
'TS' => array('Ц'),
'YA' => array('Я'),
'YU' => array('Ю'),
'ZH' => array('Ж')
'ZH' => array('Ж'),
' ' => array("\xC2\xA0", "\xE2\x80\x89", "\xE2\x80\xAF",
"\xE3\x80\x80"),
);
foreach ($charsArray as $key => $value) {

View File

@@ -172,6 +172,7 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('test string', 'test string'),
array('Ο συγγραφέας', ' Ο συγγραφέας '),
array('123', ' 123 '),
array('', ' ', 'UTF-8'), // no-break space
array('1 2 3', '  1  2  3  ', 'UTF-8'), // ideographic spaces
array('', ' ', 'UTF-8'), // thin space and space
array('', ' '),
@@ -188,7 +189,10 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array('perevirka', 'перевірка'),
array('lysaya gora', 'лысая гора'),
array('shchuka', 'щука'),
array('', '漢字')
array('', '漢字'),
array(' ', ' '), // no-break space
array(' 1 2 3 ', '  1  2  3  '), // ideographic spaces
array(' ', ' '), // thin space and space
);
}
@@ -822,6 +826,7 @@ abstract class CommonTest extends PHPUnit_Framework_TestCase
array(false, "\n\t ' \v\f"),
array(false, "\n\t 2 \v\f"),
array(true, '', 'UTF-8'),
array(true, ' ', 'UTF-8'), // no-break space
array(true, ' ', 'UTF-8'), // thin space
array(true, '  ', 'UTF-8'), // ideographic spaces
array(false, ' z', 'UTF-8'),