"Wikitravel has a speed and convenience the books' publishers can only envy." Time Europe

Tech:ListingEditor cannot handle the value of name field in non-ASCII characters

From Wikitravel Shared

Jump to: navigation, search

[edit] What happens

If I put "Замок Святого Ангела", Castel Sant' Angelo in Russian, into name filed of listing editor, url of "edit" link become http://wikitravel.org/shared/Tech:ListingEditor_cannot_handle_the_value_of_name_field_in_non-ASCII_characters#__.

  • Замок Святого Ангела.  edit

If I put "香港君悅酒店", Grand Hyatt Hong Kong in Chinese, into name filed of listing editor, "edit" link doesn't come up.

  • 香港君悅酒店.

[edit] When it happens

These problems always occur when non-ASCII characters are put into name filed.

[edit] What should happen

In both cases, "edit" link should come up with properly encoded url.

[edit] How to fix it

Before set id attribute and url of "edit" link, encode the value of name field by the same way of MediaWiki's "anchorencode" colon function. (source code of MediaWiki 1.15.0, the first implementation)


	static function anchorencode( $parser, $text ) {
		$a = urlencode( $text );
		$a = strtr( $a, array( '%' => '.', '+' => '_' ) );
		# leave colons alone, however
		$a = str_replace( '.3A', ':', $a );
		return $a;
	}

[edit] Additional comments

I'd love to use ListingEditor on Chinese version of Wikitravel. This and non-ASCII characters in the "alt" field are big problem to use ListingEditor on that language version.

[edit] Sign below, please

-- Tatata 07:33, 15 June 2009 (EDT)

We are hoping this will be fixed with the next upgrade. Ibsteph 04;49 pm, 18 February 2010 (EDT)