You are here:  » Accent in Title

Support Forum



Accent in Title

Submitted by coyote on Fri, 2008-05-23 13:54 in

Hello David

I succeeded in managing the accents with my rewriting (as i use French feeds)

so with a category named Télévision, i have this url : Television.php

the problem is that my title is Television and i would like to have Télévision with the accents (for the categories and products titles)

i saw in search.php it was defined by :

$q = (isset($_GET["q"])?tapestry_normalise($_GET["q"],":\."):"");

and then :

$header["title"] = $q;

but i cant manage to keep the accents in the title ...

my config is in iso-8859-1 charset

Thanks for your help

Coyote

Submitted by support on Sat, 2008-05-24 08:02

Hello Coyote,

With an character set defined, tapestry_normalise() should not strip the accented characters, so it sounds like the actual value of $q (or rather $_GET["q"]) that is coming into the feed does not have the accented characters.

Could you perhaps post the code you are using at the top of Television.php to set the query (or perhaps email the file to me if you like) and i'll take a look...

Cheers,
David.

Submitted by coyote on Sat, 2008-05-24 15:47

Hi David

Thank you for your answer

I just tried to find out where it could come from with no success

but i identified the problem in some way :

it seems it is not due to the function tapestry normalise (which yet is concerned as $q is defined by : $q = (isset($_GET["q"])?tapestry_normalise($_GET["q"],":\."):""); in search.php)

actually titles follow the changes i make to tapestry hyphenate ! i cant understand why, but each time i make a modification to this function, it changes my title

i have this in hyphenate :

  function tapestry_hyphenate($text)
  {
    $text = str_replace(" ","-",$text);
    $text = str_replace("é","e",$text);
    $text = str_replace("è","e",$text);
    $text = str_replace("à","a",$text);
    $text = str_replace("ï","i",$text);
    $text = strtolower($text);
    return $text;
  }

if i remove the str replace é by e for instance, é appear again in Titles... but also in urls of course, thats the problem

what could be the relation with hyphenate ?

cheers

Coyote

ps : my normalise function (i didnt change it i think)

  function tapestry_normalise($text,$allow = "")
  {
    global $config_charset;
    $text = str_replace("-"," ",$text);
    if ($config_charset)
    {
      $allow = chr(0x80).'-'.chr(0xFF).$allow;
    }
    $text = preg_replace('/[^A-Za-z0-9'.$allow.' ]/e','',$text);
    $text = preg_replace('/[ ]{2,}/',' ',$text);
    return $text;
  }

Submitted by support on Sun, 2008-05-25 08:28

Hello Coyote,

That would make sense, since $q is derived exactly from the URL, which is always hyphenated to make the search engine friendly URLs, and therefore having the accented characters stripped by this function.

I presume that the code you have added to swap the accented characters is in place for another reason; so whilst you can remove these lines to make your titles appear as you want, does this introduce another problem elsewhere?

Cheers,
David.

Submitted by coyote on Wed, 2008-05-28 05:11

I finally chose to skip the accents ;)

Cheers,

Coyote