Permalink
Browse files

[-] BO : fixed accentuated URLs in products

  • Loading branch information...
1 parent 1986ed9 commit 03101f3bab9842cbe814b90d1886f626af5d2bba Damien Metzger committed Dec 31, 2012
Showing with 26 additions and 4 deletions.
  1. +26 −4 js/admin.js
View
30 js/admin.js
@@ -27,16 +27,38 @@ var ajax_running_timeout = null;
if (!id_language)
var id_language = Number(1);
-function str2url(str,encoding,ucfirst)
+function str2url(str, encoding, ucfirst)
{
str = str.toUpperCase();
str = str.toLowerCase();
if (PS_ALLOW_ACCENTED_CHARS_URL)
str = str.replace(/[^a-z0-9\s\'\:\/\[\]-]\\u00A1-\\uFFFF/g,'');
- else
+ else
+ {
+ str = str.replace(/[\u0105\u0104\u00E0\u00E1\u00E2\u00E3\u00E4\u00E5]/g,'a');
+ str = str.replace(/[\u00E7\u010D\u0107\u0106]/g,'c');
+ str = str.replace(/[\u010F]/g,'d');
+ str = str.replace(/[\u00E8\u00E9\u00EA\u00EB\u011B\u0119\u0118\u0117]/g,'e');
+ str = str.replace(/[\u00EC\u00ED\u00EE\u00EF\u012F]/g,'i');
+ str = str.replace(/[\u0142\u0141]/g,'l');
+ str = str.replace(/[\u00F1\u0148]/g,'n');
+ str = str.replace(/[\u00F2\u00F3\u00F4\u00F5\u00F6\u00F8\u00D3]/g,'o');
+ str = str.replace(/[\u0159]/g,'r');
+ str = str.replace(/[\u015B\u015A\u0161]/g,'s');
+ str = str.replace(/[\u00DF]/g,'ss');
+ str = str.replace(/[\u0165]/g,'t');
+ str = str.replace(/[\u00F9\u00FA\u00FB\u00FC\u016F\u016B\u0173]/g,'u');
+ str = str.replace(/[\u00FD\u00FF]/g,'y');
+ str = str.replace(/[\u017C\u017A\u017B\u0179\u017E]/g,'z');
+ str = str.replace(/[\u00E6]/g,'ae');
+ str = str.replace(/[\u0153]/g,'oe');
+ str = str.replace(/[\u013E\u013A]/g,'l');
+ str = str.replace(/[\u0155]/g,'r');
+
str = str.replace(/[^a-z0-9\s\'\:\/\[\]-]/g,'');
- str = str.replace(/[\u0028\u0029\u0021\u003F\u002E\u0026\u005E\u007E\u002B\u002A\u002F\u003A\u003B\u003C\u003D\u003E]/g,'');
- str = str.replace(/[\s\'\:\/\[\]-]+/g,' ');
+ }
+ str = str.replace(/[\u0028\u0029\u0021\u003F\u002E\u0026\u005E\u007E\u002B\u002A\u002F\u003A\u003B\u003C\u003D\u003E]/g, '');
+ str = str.replace(/[\s\'\:\/\[\]-]+/g, ' ');
// Add special char not used for url rewrite
str = str.replace(/[ ]/g, '-');

0 comments on commit 03101f3

Please sign in to comment.