5_tfeq
Last Updated: February 25, 2016
·
847
· ichiriac

Generic way to sanitize url by stripping any special char

3 Responses
Add your response

2560

OK, great. Now try to transform this 'sanitized' URL back?

Some religious rules disallow you use urlencode()?

By the way, do you happen to know this guy?)
https://coderwall.com/p/a-viza

over 1 year ago ·
2562

@dimasmagadan Hi,

The short answer for not using urlencode is yes, I know about it and I don't want to use it.

For more explanations, the reason is that I need to build a unique URLs index and I don't care about retrieving the original title from the URL, but with these function I can filter all url variations and be sure that urls are not the same :

  • case sensitive
  • ignore any accents
  • removing tags
  • remove special chars
  • (optionnaly) only alpha numerics
over 1 year ago ·
2580

Forked, a while ago :)

over 1 year ago ·