vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Forum and Server Management (https://vborg.vbsupport.ru/forumdisplay.php?f=232)
-   -   Removing accented UTF8 characters from URL (https://vborg.vbsupport.ru/showthread.php?t=265525)

Morpheus NS 06-20-2011 09:51 AM

Removing accented UTF8 characters from URL
 
Hello, everyone! I am using .htaccess to make my links simpler, but there is a problem.

My forum is in serbian, and I have a problem because my thread names sometimes contain accented letters (š, ć, đ, etc.). Those letters look different in URLs, or doesn't show at all. I am trying to replace them with non-accented letters (s, c, dj in this case) which are easily readable in my language. I got this code:

Code:

function google($input){
    setlocale(LC_ALL, "en_US.UTF8");
    $input = str_replace(array("'", "-", "đ"), array("", "", "dj"), $input);
    $input = mb_convert_case($input, MB_CASE_LOWER, "UTF-8");
    $input = iconv("UTF-8", "ASCII//TRANSLIT", $input);
    $input = preg_replace("#[^a-zA-Z0-9]+#", "-", $input);
    $input = preg_replace("#(-){2,}#", "$1", $input);
    $input = trim($input, "-");
    return $input;
}

which should do the trick for me, but I don't know where (in which file) do I have to put this code to work. Any idea? I am using vBulletin 4.1.1

LifesGreatestGift 06-21-2011 11:08 PM

probably a file that has to do with creating new threads ;)

Morpheus NS 06-25-2011 01:42 PM

class_friendly_url.php seems to be doing that part of the job. :) If I am right, where do you think I should put this code?

Videx 06-26-2011 12:49 AM

I'm willing to bet this has been done before so you really shouldn't need to write code for it. I mean. vb has been international for years, so you can't be the first person with the problem.

Have you searched at vb.com?


All times are GMT. The time now is 05:10 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
  • Page Generation 0.01525 seconds
  • Memory Usage 1,709KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete