Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adjust handling for greek characters. fixes #3188
This fixes an error in the case conversion table and removes "normal" greek letters from the list of special characters. Mathematical symbols based on greek letters are still considered special chars.
- Loading branch information
1 parent
5a56359
commit a1c2692
Showing
4 changed files
with
40 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,38 @@ | ||
<?php | ||
// use no mbstring help here | ||
if(!defined('UTF8_NOMBSTRING')) define('UTF8_NOMBSTRING',1); | ||
|
||
class utf8_stripspecials extends DokuWikiTest { | ||
class utf8_stripspecials extends DokuWikiTest | ||
{ | ||
|
||
/** | ||
* @return array | ||
* @see testGivens | ||
*/ | ||
function provideGivens() | ||
{ | ||
return [ | ||
['asciistring', '', '', 'asciistring'], | ||
['asciistring', '', '\._\-:', 'asciistring'], | ||
['ascii.string', '', '\._\-:', 'asciistring'], | ||
['ascii.string', ' ', '\._\-:', 'ascii string'], | ||
['2.1.14', ' ', '\._\-:', '2 1 14'], | ||
['ascii.string', '', '\._\-:\*', 'asciistring'], | ||
['ascii.string', ' ', '\._\-:\*', 'ascii string'], | ||
['2.1.14', ' ', '\._\-:\*', '2 1 14'], | ||
['string with nbsps', '_', '\*', 'string_with_nbsps'], | ||
['αβγδεϝϛζηθικλμνξοπϟϙρστυφχψωϡ', '_', '', 'αβγδεϝϛζηθικλμνξοπϟϙρστυφχψωϡ'], // #3188 | ||
]; | ||
} | ||
|
||
function test1(){ | ||
// we test multiple cases here - format: string, repl, additional, test | ||
$tests = array(); | ||
$tests[] = array('asciistring','','','asciistring'); | ||
$tests[] = array('asciistring','','\._\-:','asciistring'); | ||
$tests[] = array('ascii.string','','\._\-:','asciistring'); | ||
$tests[] = array('ascii.string',' ','\._\-:','ascii string'); | ||
$tests[] = array('2.1.14',' ','\._\-:','2 1 14'); | ||
$tests[] = array('ascii.string','','\._\-:\*','asciistring'); | ||
$tests[] = array('ascii.string',' ','\._\-:\*','ascii string'); | ||
$tests[] = array('2.1.14',' ','\._\-:\*','2 1 14'); | ||
$tests[] = array('string with nbsps','_','\*','string_with_nbsps'); | ||
|
||
foreach($tests as $test){ | ||
$this->assertEquals(\dokuwiki\Utf8\Clean::stripspecials($test[0],$test[1],$test[2]),$test[3]); | ||
} | ||
/** | ||
* @param string $string | ||
* @param string $replacement | ||
* @param string $additional | ||
* @param string $expected | ||
* @dataProvider provideGivens | ||
*/ | ||
function testGivens($string, $replacement, $additional, $expected) | ||
{ | ||
$this->assertEquals($expected, \dokuwiki\Utf8\Clean::stripspecials($string, $replacement, $additional)); | ||
} | ||
|
||
} | ||
//Setup VIM: ex: et ts=4 : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -239,7 +239,7 @@ | |
'Ο' => 'ο', | ||
'Π' => 'π', | ||
'Ρ' => 'ρ', | ||
'Σ' => 'ς', | ||
'Σ' => 'σ', | ||
'Τ' => 'τ', | ||
'Υ' => 'υ', | ||
'Φ' => 'φ', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters