Jump to content
Latest News: (loading..)
Sign in to follow this  
sonictrip.net

€ in product title is breaking url

Recommended Posts

Hi,

 

Does anyone know how to fix this. When we use a € symbol in a product title, like (Save €20), it uses the € in the url and comes up with "Product not found" when you click into the product.

 

So, for example, here's how the url looks:

product_info.php?pName=orthopaedic-seat-cushion-save-€1000

 

Anytime a € is used in the title, the product wont work...

 

However, when i click into the address bar, and then hit enter again, it changes to:

product_info.php?pName=orthopaedic-seat-cushion-save-%801000

and loads the product up normally!

 

So, its changing the € to %80 when i hit enter again, but it would be nice if it just went straight to %80 instead of keeping the € in the title.

 

So, im trying to change the html_ouput.php file to get it to change € to %80 and a few googles turned this up for doing the conversion:

 

$str = "%20";
$str2 = urldecode($str);
echo $str2;

 

Thats for changing a space to _ but i need a € to %80 so im assuming it should be something like

 

$str = "€";
$str2 = urldecode($str);
echo $str2;

 

Only thing is, i've tried putting this into html_output.php but can't get it to change the € to %80.

 

Here's the HTML link wrapper function from my html_output.php file, maybe someone can tell me how to add the code to this?

 

////
// The HTML href link wrapper function
// {{ SEO
 function seo_urlencode($str)
 {
   switch (SEO_URL_ENCODING_METHOD)
   {
   case 'Replace with Underscore (_)':
     $str = urlencode($str);
     $str = preg_replace("/(%[\da-f]{2}|\+)/i", "_", $str);
     return urlencode(strlen($str) > 0 ? $str : ' ');
   case 'Replace Umlauts with 2 Letters Equivs, Other - with (_)':
     $search = array ("'?'",
                      "'?'",
                      "'?'",
                      "'?'",
                      "'?'",
                      "'?'",
                      "'?'");
     $replace = array ("ss",
                       "ae",
                       "oe",
                       "ue",
                       "AE",
                       "OE",
                       "UE");
     $str = preg_replace($search, $replace, $str);
     $str = urlencode($str);
     $str = preg_replace("/(%[\da-f]{2}|\+)/i", "_", $str);
     return urlencode(strlen($str) > 0 ? $str : ' ');
   case 'Standard URL Encode (%XX)': default:
     $str = str_replace('&', urlencode(urlencode('&')), $str);
     $str = str_replace('#', urlencode(urlencode('#')), $str);
     $str = str_replace('/', urlencode(urlencode('/')), $str);
     $str = str_replace('+', urlencode(urlencode('+')), $str);
     return urlencode(strlen($str) > 0 ? $str : ' ');
   }
 }

 function seo_categories_path($cPath_param)
 {
   global $languages_id;

   if (SEO_URL_PARTS_CATEGORIES == 'Full Categories Path')
   {
     $url = '';
     $arr = explode('_', $cPath_param);
     for ($i=0,$n=sizeof($arr);$i<$n;$i++){
       $res = tep_db_query("select categories_id, categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id ='" . $arr[$i] . "' and language_id = '" . (int)$languages_id . "'");
       $data = tep_db_fetch_array($res);
       if (SEO_URL_ENCODING_METHOD == 'Standard URL Encode (%XX)')
       {
         $url .= seo_urlencode($data['categories_name']) . '/';
       }
       else
       {
         $url .= seo_urlencode($data['categories_name']) . '.' . $data['categories_id'] . '/';
       }
     }
   }
   else
   {
     $arr = explode('_', $cPath_param);
     $curr_cat = $arr[count($arr) - 1];
     $parent_cat = $arr[count($arr) - 2];
     $res = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_CATEGORIES . " c where c.categories_id = cd.categories_id and c.categories_id = '" . (int)$curr_cat . "' and c.parent_id = '" . (int)$parent_cat . "' and cd.language_id = '" . (int)$languages_id . "'");
     $data = tep_db_fetch_array($res);
     $url = seo_urlencode($data['categories_name']) . '.' . $data['categories_id'] . '/';
   } // end if (SEO_URL_PARTS_CATEGORIES == 'Full Categories Path')
   return $url;
 }
// }}

 

Im looking into upgrading the SEO URLS version to v5 coz i think it said they support Windows servers too but thats the reason why im still on v2.0b and its only the later versions that have character conversion built in, which only work on Linux afaik, until v5.

 

Thanks for the help!

Edited by sonictrip.net

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×