Alphabar (and path for initial page, ets.) for non Latin letters

Pozniy - December 22, 2006 - 20:54
Project:G2 Glossary
Version:4.7.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:fgm
Status:closed
Description

Most of my glossary terms are in non Latin and I would like an alphabar to display non Latin characters. Currently it is set to display letters 'a'->'z' and non-working initial page path (example: "... ?q=g2/initial/%25D1%258F" and
"Entries starting by initial %D1%8F
Displaying 0 entries starting by '%D1%8F' from a total number of 1 entries.
Admin info: there are also 0 unpublished matching entries from a total number of 0 unpublished entries.
" instead sub-list of terms).

How do I change this?

#1

fgm - December 23, 2006 - 08:59
Category:bug report» support request
Status:needs work» postponed (maintainer needs more info)

Hi,

The problem seems to be twofold. As you surmised, G2 was written with Latin-1 in mind, and more generally should work "out of the box" only with character sets within the Unicode Basic Multilingual Plane.

  • _g2_alphabar() which generates the alphabar, processes each initial through urlencode to avoid generating characters with specific meaning in an URL like amperstands or question marks. This is why you see %25D1%258F : these URLs seem to be proper. If I type я in the firefox address bar, it get rewritten as %D1%8F, for instance.
  • the URLs you pass to Drupal for G2 are processed first when generating the page by the G2 theme function theme_g2_initial() : if I try either http://www.riff.org/g2/initial/я or http://www.riff.org/g2/initial/%D1%8F, or http://www.riff.org/g2/initial/%25D1%258F as you suggest in your example, after adding a fictitious entry яяяя to my G2 and the я symbol in the alphabar, G2 correctly returns an initial page for я: it does not display "...starting by '%D1%8F' from..." but (the french equivalent of) "...starting by 'я' from ...", which seems correct to me.

Can you try a few samples of the URLs you obtain on my site, so we can ascertain whether theme_g2_initial and _g2_initial work correctly ? It seems to me as if they were working on my site, but not on yours, which might point to one of two problems:

  • maybe you are not using the proper version of the 4.7 module : current version is 1.15.2.10
  • maybe your PHP is missing some Unicode support. Can you provide a link to your phpinfo() page ?

You can also contact me directly using the contact form or (as "osinet") on #drupal, #drupal-support, #drupal-ecommerce or #php-gtk so we can discuss this interactively: my setting being latin-1, I may not be able to reproduce your problem and we may need to perform tests together.

Before trying to fix the module itself, I also suggest you try to override theme_g2_alphabar in your theme file: this will allow you to try different looks for the alphabar without messing with the module itself.

#2

fgm - December 24, 2006 - 10:32
Assigned to:Anonymous» fgm
Status:postponed (maintainer needs more info)» active

The URLs like %25d0%2594 are normal and work normally on a fully configured site with clean URLs.

However, the problem appears when clean URLs are not activated. In this case, G2 receives an improper path.

#3

fgm - December 24, 2006 - 10:56

Another variant: URLs like %d0%94 work correctly with both clean and not clean URLs.

#4

fgm - December 24, 2006 - 22:13
Category:support request» feature request
Status:active» fixed

Features supporting this type of scenario have been added in 1.15.2.11.

The problem detailed in http://drupal.org/node/105067 is not covered, since G2 no longer generates this type of URLs.

#5

Anonymous - January 7, 2007 - 22:15
Status:fixed» closed

#6

fgm - February 4, 2007 - 16:24
Status:closed» needs review

Slight change today, to cover the case of terms with a "/" in them.

#7

fgm - June 16, 2007 - 09:03
Status:needs review» fixed

No comments in over 3 months, closing.

#8

Anonymous - June 30, 2007 - 09:15
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.