Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 408195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:40:08+00:00 2026-05-12T17:40:08+00:00

I’ve just tested locally my web application, everything works fine, but after uploading to

  • 0

I’ve just tested locally my web application, everything works fine, but after uploading to server application behaves differently. I use function formatiraj_string_url to convert diacritic symbols and get clean url… locally it works fine but on server this function doesnt convert them the same way.

Few days earlier I tested this on some third server and it worked fine. Now I’m uploading web to test it again on this third server, but I just wonder what could really be the cause of such behavior?

function formatiraj_string_url($string)
    {
        $string = strtolower($string);

        $znak[0] = ' ';
        $znak[1] = 'Š';
        $znak[2] = 'š';
        $znak[3] = 'Đ';
        $znak[4] = 'đ';
        $znak[5] = 'Č';
        $znak[6] = 'č';
        $znak[7] = 'Ć';
        $znak[8] = 'ć';
        $znak[9] = 'Ž';
        $znak[10] = 'ž';
        $znak[11] = 'Š';
        $znak[12] = 'Đ';
        $znak[13] = 'Č';
        $znak[14] = 'Ć';
        $znak[15] = 'Ž';
        $znak[16] = 'š';
        $znak[17] = 'đ';
        $znak[18] = 'č';
        $znak[19] = 'ć';
        $znak[20] = 'ž';
        $znak[21] = 'Š'; // Š
        $znak[22] = 'š'; // š

        $zamjena[0] = '-';
        $zamjena[1] = 's';
        $zamjena[2] = 's';
        $zamjena[3] = 'd';
        $zamjena[4] = 'd';
        $zamjena[5] = 'c';
        $zamjena[6] = 'c';
        $zamjena[7] = 'c';
        $zamjena[8] = 'c';
        $zamjena[9] = 'z';
        $zamjena[10] = 'z';
        $zamjena[11] = 's';
        $zamjena[12] = 'd';
        $zamjena[13] = 'c';
        $zamjena[14] = 'c';
        $zamjena[15] = 'z';
        $zamjena[16] = 's';
        $zamjena[17] = 'd';
        $zamjena[18] = 'c';
        $zamjena[19] = 'c';
        $zamjena[20] = 'z';
        $zamjena[21] = 's';
        $zamjena[22] = 's';

        $string = str_replace($znak, $zamjena, $string);
        $new_string = preg_replace("/[^a-zA-Z0-9-s]/", "", $string);
        return $new_string;
    }

EDIT: Before str_replace, this function used preg_replace. On server this was the error showed:

Warning: preg_replace() [function.preg-replace]: Compilation failed: nothing to repeat at offset 0 in /home2/sinjcom/public_html/sinj.com.hr/administracija/include/funkcije.php on line 200

But locally, I didn’t have this problem

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T17:40:08+00:00Added an answer on May 12, 2026 at 5:40 pm

    Which charset is your file written in?

    Since you have written the characters you would like to replace directly into your code, as strings, they are encoded in whatever charset the file uses. If that charset differs from what you get from the browser, your functions aren’t going to work.

    The important point you need to keep in mind, is to always keep track of the charset your strings are encoded with, and convert when neccessary.

    Take a look at Kore Nordmanns FAQ about charsets in PHP for some more pointers about charsets.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
I would like my Web page http://www.gmarks.org/math_in_e-mail.txt on my Apache 2.2.14 server to display
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.