Skip to content

Commit 667ef1f

Browse files
committed
Formatting: Transform “ẞ” for German locales in remove_accents().
The capital Eszett was standardized in German orthography in 2017, DIN 5008, but WordPress has only been transforming the lowercase version. This patch adds the uppercase variant to the list and transforms it to “SS” for more-appriate slug and permalink generation. Developed in: #11188 Discussed in: https://core.trac.wordpress.org/ticket/64821 Props apermo, dmsnell. Fixes #64821. git-svn-id: https://develop.svn.wordpress.org/trunk@61855 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b8729ff commit 667ef1f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/wp-includes/formatting.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,7 @@ function utf8_uri_encode( $utf8_string, $length = 0, $encode_ascii_characters =
15661566
* | U+00F6 | ö | oe | Latin small letter o with diaeresis |
15671567
* | U+00DC | Ü | Ue | Latin capital letter U with diaeresis |
15681568
* | U+00FC | ü | ue | Latin small letter u with diaeresis |
1569+
* | U+1E9E | ẞ | SS | Latin capital letter sharp s |
15691570
* | U+00DF | ß | ss | Latin small letter sharp s |
15701571
*
15711572
* Danish (`da_DK`) locale:
@@ -1599,6 +1600,7 @@ function utf8_uri_encode( $utf8_string, $length = 0, $encode_ascii_characters =
15991600
* @since 5.7.0 Added locale support for `de_AT`.
16001601
* @since 6.0.0 Added the `$locale` parameter.
16011602
* @since 6.1.0 Added Unicode NFC encoding normalization support.
1603+
* @since 7.0.0 Added capital Eszett (U+1E9E) support for German locales.
16021604
*
16031605
* @param string $text Text that might have accent characters.
16041606
* @param string $locale Optional. The locale to use for accent removal. Some character
@@ -1972,6 +1974,7 @@ function remove_accents( $text, $locale = '' ) {
19721974
$chars['ö'] = 'oe';
19731975
$chars['Ü'] = 'Ue';
19741976
$chars['ü'] = 'ue';
1977+
$chars[''] = 'SS';
19751978
$chars['ß'] = 'ss';
19761979
} elseif ( 'da_DK' === $locale ) {
19771980
$chars['Æ'] = 'Ae';

tests/phpunit/tests/formatting/removeAccents.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ public function test_remove_accents_germanic_umlauts() {
108108
$this->assertSame( 'AeOeUeaeoeuess', remove_accents( 'ÄÖÜäöüß', 'de_DE' ) );
109109
}
110110

111+
/**
112+
* @ticket 64821
113+
*/
114+
public function test_remove_accents_germanic_capital_eszett() {
115+
// U+1E9E LATIN CAPITAL LETTER SHARP S, standardized in German orthography in 2017 (DIN 5008).
116+
$this->assertSame( 'SS', remove_accents( '', 'de_DE' ) );
117+
// Verify it works in context alongside the lowercase variant.
118+
$this->assertSame( 'SSstrasse', remove_accents( 'ẞstraße', 'de_DE' ) );
119+
}
120+
111121
/**
112122
* @ticket 23907
113123
*/

0 commit comments

Comments
 (0)