Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Search engine friendly URL's to work with Scandinavian letters?
I'm having a small problem.
I would like to see the finnish letter "ä" transformed into an "a" and the finnish letter "ö" transformed into an "o" in the URL of my forum posts. Now it just cuts those letters off and the URL looks a bit weird if those letters are used (which is quite often).
For example I have a discussion called "Onko nettideittailu vieläkään hyväksyttävää nykypäivänä?" which shows in the URL as "/onko-nettideittailu-vielkn-hyvksyttv-nykypivn/". Here's the live example (hope you see all the letters correctly): http://otamut.org/keskustelu/discussion/5/onko-nettideittailu-vielkn-hyvksyttv-nykypivn/
How could I fix this?
I would like to see the finnish letter "ä" transformed into an "a" and the finnish letter "ö" transformed into an "o" in the URL of my forum posts. Now it just cuts those letters off and the URL looks a bit weird if those letters are used (which is quite often).
For example I have a discussion called "Onko nettideittailu vieläkään hyväksyttävää nykypäivänä?" which shows in the URL as "/onko-nettideittailu-vielkn-hyvksyttv-nykypivn/". Here's the live example (hope you see all the letters correctly): http://otamut.org/keskustelu/discussion/5/onko-nettideittailu-vielkn-hyvksyttv-nykypivn/
How could I fix this?
0
This discussion has been closed.
Comments
function unaccent($text) { $trans = get_html_translation_table(HTML_ENTITIES); foreach ($trans as $literal =>$entity) { if (ord($literal)>=192) { $replace[]=substr($entity,1,1); $search[]=$literal; } } return str_replace($search, $replace, $text); }
function CleanupString($InString) { $Code = explode(',', '<,>,',&,",À,Ã,Â,Ã,Ä,Ä,Ã…,Ä€,Ä„,Ä‚,Æ,Ç,Ć,ÄŒ,Ĉ,ÄŠ,ÄŽ,Ä,Ã,È,É,Ê,Ë,Ä’,Ę,Äš,Ä”,Ä–,Äœ,Äž,Ä ,Ä¢,Ĥ,Ħ,ÃŒ,Ã,ÃŽ,Ã,Ī,Ĩ,Ĭ,Ä®,Ä°,IJ,Ä´,Ķ,Å,Ľ,Ĺ,Ä»,Ä¿,Ñ,Ń,Ň,Å…,ÅŠ,Ã’,Ó,Ô,Õ,Ö,Ö,Ø,ÅŒ,Å,ÅŽ,Å’,Å”,Ř,Å–,Åš,Å ,Åž,Åœ,Ș,Ť,Å¢,Ŧ,Èš,Ù,Ú,Û,Ãœ,Ū,Ü,Å®,Å°,Ŭ,Ũ,Ų,Å´,Ã,Ŷ,Ÿ,Ź,Ž,Å»,Þ,Þ,à ,á,â,ã,ä,ä,Ã¥,Ä,Ä…,ă,æ,ç,ć,Ä,ĉ,Ä‹,Ä,Ä‘,ð,è,é,ê,ë,Ä“,Ä™,Ä›,Ä•,Ä—,Æ’,Ä,ÄŸ,Ä¡,Ä£,Ä¥,ħ,ì,Ã,î,ï,Ä«,Ä©,Ä,į,ı,ij,ĵ,Ä·,ĸ,Å‚,ľ,ĺ,ļ,Å€,ñ,Å„,ň,ņ,ʼn,Å‹,ò,ó,ô,õ,ö,ö,ø,Å,Å‘,Å,Å“,Å•,Å™,Å—,Å¡,ù,ú,û,ü,Å«,ü,ů,ű,Å,Å©,ų,ŵ,ý,ÿ,Å·,ž,ż,ź,þ,ß,Å¿,Ð,Б,Ð’,Г,Д,Е,Ð,Ж,З,И,Й,К,Л,Ðœ,Ð,О,П,Ð ,С,Т,У,Ф,Ð¥,Ц,Ч,Ш,Щ,Ъ,Ы,Ð,Ю,Я,а,б,в,г,д,е,Ñ‘,ж,з,и,й,к,л,м,н,о,п,Ñ€,Ñ,Ñ‚,у,Ñ„,Ñ…,ц,ч,ш,щ,ÑŠ,Ñ‹,Ñ,ÑŽ,Ñ'); $Translation = explode(',', ',,,,,A,A,A,A,Ae,A,A,A,A,A,Ae,C,C,C,C,C,D,D,D,E,E,E,E,E,E,E,E,E,G,G,G,G,H,H,I,I,I,I,I,I,I,I,I,IJ,J,K,K,K,K,K,K,N,N,N,N,N,O,O,O,O,Oe,Oe,O,O,O,O,OE,R,R,R,S,S,S,S,S,T,T,T,T,U,U,U,Ue,U,Ue,U,U,U,U,U,W,Y,Y,Y,Z,Z,Z,T,T,a,a,a,a,ae,ae,a,a,a,a,ae,c,c,c,c,c,d,d,d,e,e,e,e,e,e,e,e,e,f,g,g,g,g,h,h,i,i,i,i,i,i,i,i,i,ij,j,k,k,l,l,l,l,l,n,n,n,n,n,n,o,o,o,o,oe,oe,o,o,o,o,oe,r,r,r,s,u,u,u,ue,u,ue,u,u,u,u,u,w,y,y,y,z,z,z,t,ss,ss,A,B,V,G,D,E,YO,ZH,Z,I,Y,K,L,M,N,O,P,R,S,T,U,F,H,C,CH,SH,SCH,Y,Y,E,YU,YA,a,b,v,g,d,e,yo,zh,z,i,y,k,l,m,n,o,p,r,s,t,u,f,h,c,ch,sh,sch,y,y,e,yu,ya'); $sReturn = $InString; $sReturn = str_replace($Code, $Translation, $sReturn); $sReturn = urldecode($sReturn); $sReturn = preg_replace('/[^A-Za-z0-9 ]/', '', $sReturn); $sReturn = str_replace(' ', '-', $sReturn); return strtolower(str_replace('--', '-', $sReturn)); }
If I understand correctly that function replaces some of the special characters into more common characters. And I spotted my letters there so it should work?
I'm not great with the inner workings of character encodings, but I know that there are a few other members on here who are - I'm hoping one or two of them will join in on the discussion...