![]() |
Friendly URLs - UTF-8 to ASCII
Hi,
I'd need to convert all the links on the forum to ASCII (right now, they are in UTF-8 with accents). Basic conversion to base characters would be fine for me. Is there a way to do this in vB4.2.2, or do I have to code it manually? Note: ASCII urls already work (if I enter manually converted URL in ASCII, vB routes me to the right page), so the only thing I need is actually links modification Thanks! Martin |
I'm not sure what you mean. There's probably code somewhere that would change accented characters to the closest ASCII, but if you're talking about the actual url, it wouldn't be the same url when you were done.
|
example:
now a forum link looks like this Code:
forum/3-????žť Code:
forum/3-ieayzt Thanks! |
Quote:
|
OK, I haven't tested this a lot, but you might try this: I found a function that someone wrote here: https://gist.github.com/evaisse/169594 that replaces accented characters in a string. But since I don't know about the licensing, I won't copy it here. But you can copy it yourself and paste it in to a plugin.
So, you can create a new plugin using hook location friendlyurl_geturl and code like this: Code:
if (!function_exists('remove_accents')) Then go to that site, copy the code (but not the first line that starts with <?php), and paste it where indicated. Also one other thing, there seems to be a minor bug in that function, so you should find this line: Code:
if( !function_exists('mb_detect_encoding') ) { and remove the ! so that it looks like: Code:
if( function_exists('mb_detect_encoding') ) { |
Thank you for the help!
This is what I call honest and quick help. You helped me a lot, and it works pretty good - I'll test it on live forum soon. But so far, I don't see any problem with the code + there is quiet strong coverage of accented characters. So, again, thanks a lot, Kevin. |
All times are GMT. The time now is 08:26 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|