Skip to content

Commit fb001aa

Browse files
committed
General: Add a test to check that unicode generally survives in slugs
Until now, WordPress generated all-ASCII slugs, which works well for mostly-ASCII languages. Now that WordPress supports scripts like Devanagari much better, it's necessary to test the slug support for Devanagari. What WordPress did until now works well for Devanagari, so this commit merely adds a unit test. The ideal is to have links such as <hebrewdomain>.<hebrewtld>/<hebrewpath> which is shown onscreen as <hebrewpath>/<hebrewtld>.<hebrewdomain> without any switches between right-to-left Hebrew and left-to-right Latin. /author/ and a few others don't achieve that ideal. Yet. Note that there is a rare existing bug: The existing mapping to ASCII can produce the same slug for two pages, since two letters can map to e.g. 'L'. This seems unfixable, since any change might break existing links, but happily also extremely rare.
1 parent 435db5a commit fb001aa

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tests/phpunit/tests/formatting/sanitizeTitle.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ public function test_strips_html() {
1212
$this->assertSame( $expected, sanitize_title( $input ) );
1313
}
1414

15+
public function test_leaves_devanagari() {
16+
$input = 'राजीव';
17+
$this->assertSame( $input, urldecode( sanitize_title( $input ) ) );
18+
}
19+
1520
public function test_titles_sanitized_to_nothing_are_replaced_with_optional_fallback() {
1621
$input = '<strong></strong>';
1722
$fallback = 'Captain Awesome';

0 commit comments

Comments
 (0)