[Xapian-discuss] After upgrading to 1.2.5, Omega CGI shows spaces as %20 etc

Charles xapian at catcons.co.uk
Sat May 21 08:22:37 BST 2011


On 14/05/11 08:57, Olly Betts wrote:
> On Tue, Apr 26, 2011 at 11:44:34AM +0530, xapian at catcons.co.uk wrote:
>> After upgrading from Xapian 1.2.4 to 1.2.5, the Omega CGI shows spaces as
>> %20, apostrophes as %27 etc. For example "all letters to potential
>> members.doc" is now shown as
>> "all%20letters%20to%20potential%20members.doc".
>> This is with the default template "query".
>
> This is a deliberate change in omindex - the previous behaviour was
> actually a bug which broke links to files with certain characters
> in:
>
> Encode reserved characters in URLs - links to files with names
> containing '#' and '?' now work.
>
> Now as we build the URL we escape those characters which RFC 3986 says
> should be escaped.
>
>> Is it possible to configure Omega 1.2.5 to get the 1.2.4 style display?
>
> Is this for displaying to the user, rather than in something like <a
> href="...">?
>
> I guess for that you might want to decode some, or perhaps all
> %-escapes. You could do that for %20 like so:
>
> $list{$split{$field{url},%20}, }
>
> And you could resplit and rejoin for any others you particularly care
> about, but that gets clumsy pretty quickly if there are many.
>
> It would be fairly easy to add a $prettyurl command, if we can decide
> exactly what it should do. For example, if you decode ?, #, and %, then
> affected URLs can't be cut and pasted and actually work, while if you
> decode byte values >= 0x80, then the encoding of filenames becomes an
> issue.
>
> Cheers,
> Olly
>

Thanks Olly :-)

Yes -- it's for displaying to the user; it's a usability issue.

Changing the default template line from

<td><B><A 
HREF="$field{url}">$html{$or{$field{caption},$field{title},$field{url},Untitled}}</A></B><BR>

to

<td><B><A 
HREF="$html{$field{url}}">$html{$or{$field{caption},$field{title},$list{$split{%20,$field{url}}, 
},Untitled}}</A></B><BR>

made Xapian's search results page more human-readable.

Our organisation name includes a ' so it would be nice to translate %27 
too but my experiments with $transform (changes only the first 
occurrence?) and using nested $splits did not succeed.

A $prettyurl command would be nice.  A design guideline could be 
"maximise human readability without causing any breakage" leading to 
prettifying all but ?, #, % and all >= 0x80 ... ?

Best

Charles





More information about the Xapian-discuss mailing list