When using an Ampersand in the wiki title the wiki is stored in the database with a wiki name up to the point BUT not including the ampersand only.

For exmaple, I tried to save 'United States & Canada' and it was saved as 'United_States_'.

From what I can see in the URL at the point of edit/save the module attempts to use '%2526' for the ampersand. Should this not be simple '%26'?

Shout if I can help with further testing or if you need more testing.

This occured on a clean install of the latest version of Liquid on Drupal 5.1, PHP 4.4.4 and MySQL 4.1.21.

PS, the Mediawiki markeup is superb, great job!

Comments

sorenp’s picture

Assigned: Unassigned » sorenp
Priority: Normal » Critical

The problem with ampersand is caused by the way Drupal handles URI's.

When using the "clean URL" setting, %2526 is the correct code for ampersand. This is because the URI is decoded twice: first during the URL rewrite and then a second time before it is delivered to Drupal. If drupal is called with

www.example.com/wiki/R%26D

it will be decoded to

www.example.com/wiki/R&D

and then rewritten to

www.example.com/index.php?q=wiki/R&D

It should now be obvious why this is a problem.

As i can see, there are three possible solutions:

1) Try to find a number of hacks like the %2526 trick that covers all known situations.
2) Replace ampersand with some code (just as space is replaced by _)
3) Replace the default URI-parsing algorithm with a Liquid-specific one that can handle malformed URI's like
www.example.com/index.php?q=wiki/R&D

I must say I don't like any of the above solutions, but my bet is that I will go with number 3.

Any suggestions?

I'll look into this as soon as I get the time.

Thanks for pointing this out,

Soren

paulcoghlan’s picture

Sorry to say I am not skilled enough to be able to code.

Wouldn't it be possible to have some lookup function that knows %2526 is & and so on?

Failing that it would seem to make sense to have a function that works across all characters rather than put in a fix per character which would be never ending. Sorry I cant help with coding. I can help with testing and usage only.

Paul

sorenp’s picture

It's not that simple. The problem is that, depending on what browser you use, characters are coded once of twice. if you encode ampersand you get %26. Encode it once more and you get %2526 (since % encodes to %25). Also, ampersand has a specific meaning in URL's so you can't just pas an url with an ampersand to the server and expect that things will work out fine without some kind of special url handeling routine.

I'll look deeper into this when I get the time.

// Soren