The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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.
|
#3
|
|||
|
|||
example:
now a forum link looks like this Code:
forum/3-????žť Code:
forum/3-ieayzt Thanks! |
#4
|
|||
|
|||
Oh, and now I see where you said that in your first post and I didn't understand. Anyway, there doesn't appear to be any way to do this that's built in to vbulletin. Hopefully someone else will know more about it.
|
#5
|
|||
|
|||
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')) { // Paste copied function here } $url=remove_accents($url); 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') ) { |
#6
|
|||
|
|||
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. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|