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 7441227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:58:39+00:00 2026-05-29T10:58:39+00:00

So, this is the problem, i think everything is ok with this function, but

  • 0

So, this is the problem, i think everything is ok with this function, but URLs like:

reparações

are showing always as “reparaa-a-es”.

The expected result should be “reparacoes”

EDIT:

So, the solution was simple, it seems php has a native function that
does what i need:

rawurlencode ( string $str )


function generateSafeUrls($url = '') {
    ## normalize accented characters
    $url = strtr($url, "\xA1\xAA\xBA\xBF\xC0\xC1\xC2\xC3\xC5\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD8\xD9\xDA\xDB\xDD\xE0\xE1\xE2\xE3\xE5\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF8\xF9\xFA\xFB\xFD\xFF", "_ao_AAAAACEEEEIIIIDNOOOOOUUUYaaaaaceeeeiiiidnooooouuuyy"); 
    ## make sure its only english and dashes
    $url3 = preg_replace("/[^A-Za-z0-9_-]+/", "_", $url);
    ## return safe url
    return($url3);
}

What should be the problem?

Thanks guys.

  • 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-29T10:58:39+00:00Added an answer on May 29, 2026 at 10:58 am

    Try this on (using UTF8 decoding rather than trying to declare all the hexadecimals):

    function generateSafeUrls($url = ''){
       $bad = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ';
       $good = 'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr';  
       $url= strtr(utf8_decode($url), utf8_decode($bad), $good);
       return preg_replace("/[^A-Za-z0-9_-]+/", "_", $url);
    }
    

    However, as Conrad Shultz notes in comments, you don’t necessarily need to do this… simple urlencode()ing should be fine… if you want cleaner looking urls, you should run the preg_replace so that the URLs don’t have %20 etc, and you should probably strtolower()

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

Sidebar

Related Questions

I think I read every single web page relating to this problem but I
I'm doing everything by the book (I think), I've reviewed this problem multiple times,
This problem is happening for me on IE8 and Chrome which makes me think
I think that this problem can be sorted using reflection (a technology which I'm
I have spent too much time on this problem and am beginning to think
I'm not sure how to describe this problem, so I think an example is
I'm sure there are different approaches to this problem, and I can think of
I think this might be a problem with the theme I'm using ( Nitobe
I've editing this original question as I think I've narrowed down the problem... I
I asked this question before, Here however I think I presented the problem poorly,

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.