21
21
echo $ e ->getMessage () . \PHP_EOL ;
22
22
}
23
23
24
+ echo "\n-- Greek letter sigma -- \n" ;
25
+ var_dump (mb_convert_case ("Σ " , MB_CASE_TITLE , 'UTF-8 ' ));
26
+ var_dump (mb_convert_case ("aΣ " , MB_CASE_TITLE , 'UTF-8 ' ));
27
+ var_dump (mb_convert_case ("aΣb " , MB_CASE_TITLE , 'UTF-8 ' ));
28
+ var_dump (mb_convert_case ("aΣ b " , MB_CASE_TITLE , 'UTF-8 ' ));
29
+ var_dump (mb_convert_case (" ΣΣΣΣ " , MB_CASE_TITLE , 'UTF-8 ' ));
30
+
31
+ // Apostrophe, full stop, colon, etc. are "case-ignorable"
32
+ // When checking whether capital sigma is at the end of a word or not, we skip over
33
+ // any number of case-ignorable characters, both when scanning back and when scanning forward
34
+ var_dump (mb_convert_case ("'Σ " , MB_CASE_TITLE , 'UTF-8 ' ));
35
+ var_dump (mb_convert_case ("ab'Σ " , MB_CASE_TITLE , 'UTF-8 ' ));
36
+ var_dump (mb_convert_case ("Σ' " , MB_CASE_TITLE , 'UTF-8 ' ));
37
+ var_dump (mb_convert_case ("Σ'a " , MB_CASE_TITLE , 'UTF-8 ' ));
38
+ var_dump (mb_convert_case ("a'Σ'a " , MB_CASE_TITLE , 'UTF-8 ' ));
39
+
40
+ // We scan back by at least 63 characters when necessary,
41
+ // but there is no guarantee that we will scan back further than that
42
+ var_dump (mb_convert_case ('a ' . str_repeat ('. ' , 63 ) . "Σ " , MB_CASE_TITLE , 'UTF-8 ' ));
43
+ var_dump (mb_convert_case ('a ' . str_repeat ('. ' , 64 ) . "Σ " , MB_CASE_TITLE , 'UTF-8 ' )); // Context-sensitive casing doesn't work here!
44
+
45
+ // When scanning forward to confirm if capital sigma is at the end of a word or not,
46
+ // there is no limit as to how far we will scan
47
+ var_dump (mb_convert_case ("abcΣ " . str_repeat ('. ' , 64 ) . ' abc ' , MB_CASE_TITLE , 'UTF-8 ' ));
48
+ var_dump (mb_convert_case ("abcΣ " . str_repeat ('. ' , 64 ) . 'a abc ' , MB_CASE_TITLE , 'UTF-8 ' ));
49
+ var_dump (mb_convert_case ("abcΣ " . str_repeat ('. ' , 256 ) . ' abc ' , MB_CASE_TITLE , 'UTF-8 ' ));
50
+
24
51
/* Regression test for new implementation;
25
52
* When converting a codepoint, if we overwrite it with the converted version before
26
53
* checking whether we should shift in/out of 'title mode', then the conversion will be incorrect */
@@ -38,5 +65,22 @@ string(13) "foo bar spaß"
38
65
string(13) "Foo Bar Spaß"
39
66
string(13) "foo bar spaß"
40
67
mb_convert_case(): Argument #2 ($mode) must be one of the MB_CASE_* constants
68
+
69
+ -- Greek letter sigma --
70
+ string(2) "Σ"
71
+ string(3) "Aς"
72
+ string(4) "Aσb"
73
+ string(5) "Aς B"
74
+ string(10) " Σσσς "
75
+ string(3) "'Σ"
76
+ string(5) "Ab'ς"
77
+ string(3) "Σ'"
78
+ string(4) "Σ'a"
79
+ string(6) "A'σ'a"
80
+ string(66) "A...............................................................ς"
81
+ string(67) "A................................................................σ"
82
+ string(73) "Abcς................................................................ Abc"
83
+ string(74) "Abcσ................................................................a Abc"
84
+ string(265) "Abcς................................................................................................................................................................................................................................................................ Abc"
41
85
string(12) "02bc004e012d"
42
86
string(8) "0149012d"
0 commit comments