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.
This commit is contained in:
Andreas Gohr 2020-07-01 11:02:39 +02:00
parent 5a56359cf3
commit a1c26920aa
4 changed files with 40 additions and 30 deletions

View File

@ -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 :

View File

@ -14,6 +14,10 @@ class utf8_strtolower_test extends DokuWikiTest
['ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'],
['players:Bruce', 'players:bruce'],
['players:GERALD', 'players:gerald'],
[
'Α Β Γ Δ Ε Ϝ Ϛ Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ϟ ϙ Ρ Σ Τ Υ Φ Χ Ψ Ω Ϡ',
'α β γ δ ε ϝ ϛ ζ η θ ι κ λ μ ν ξ ο π ϟ ϙ ρ σ τ υ φ χ ψ ω ϡ'
], // #3188
];
}

View File

@ -239,7 +239,7 @@ return [
'Ο' => 'ο',
'Π' => 'π',
'Ρ' => 'ρ',
'Σ' => 'ς',
'Σ' => 'σ',
'Τ' => 'τ',
'Υ' => 'υ',
'Φ' => 'φ',

View File

@ -130,11 +130,6 @@ return [
0x384, // ΄
0x385, // ΅
0x387, // ·
0x3c6, // φ
0x3d1, // ϑ
0x3d2, // ϒ
0x3d5, // ϕ
0x3d6, // ϖ
0x5b0, // ְ
0x5b1, // ֱ
0x5b2, // ֲ
@ -613,8 +608,8 @@ return [
0x1d71a, // 𝜚
0x1d71b, // 𝜛
0xc2a0, // 슠
0xe28087, //
0xe280af, //
0xe281a0, //
0xefbbbf, //
0xe28087, //
0xe280af, //
0xe281a0, //
0xefbbbf, //
];