Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 03-10-2015, 08:31 AM
rudexpunx rudexpunx is offline
 
Join Date: Dec 2011
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 03-10-2015, 09:57 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 03-10-2015, 10:09 AM
rudexpunx rudexpunx is offline
 
Join Date: Dec 2011
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

example:

now a forum link looks like this
Code:
forum/3-????žť
what I want is
Code:
forum/3-ieayzt
This is just a matter of site links, because routing/rewrites work fine for both. I'd prefer to have forum/thread links indexed in ASCII, that's my reason.

Thanks!
Reply With Quote
  #4  
Old 03-10-2015, 11:45 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rudexpunx View Post
This is just a matter of site links, because routing/rewrites work fine for both.
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.
Reply With Quote
  #5  
Old 03-10-2015, 01:12 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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') ) {
Reply With Quote
  #6  
Old 03-10-2015, 04:49 PM
rudexpunx rudexpunx is offline
 
Join Date: Dec 2011
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:33 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06034 seconds
  • Memory Usage 2,206KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (5)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete