Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

url_title doesn't handle diacritics #2323

Closed
SteeveDroz opened this issue Oct 11, 2019 · 4 comments
Closed

url_title doesn't handle diacritics #2323

SteeveDroz opened this issue Oct 11, 2019 · 4 comments

Comments

@SteeveDroz
Copy link
Contributor

Describe the bug
When passing a string with diacritics to url_title, it doesn't handle diacritics in any way.

CodeIgniter 4 version
v4.0.0-rc.2.1

Affected module(s)
URL helper

Expected behavior, and steps to reproduce if appropriate

Currently

url_title('éléphant de PHP'); // returns "éléphant-de-PHP"
url_title('Éléphant de PHP', '-', true); // returns "Éléphant-de-php"

Expected behaviour

url_title('éléphant de PHP'); // returns "elephant-de-PHP"
url_title('Éléphant de PHP', '-', true); // returns "elephant-de-php"

// or, if retrocompatibility must be kept in some way, add a parameter

url_title('éléphant de PHP', '-', false, true); // returns "elephant-de-PHP"
url_title('Éléphant de PHP', '-', true, true); // returns "elephant-de-php"

Note

There is already a config file with the list of diacritics.

Context

  • OS: Linux Fedora 30
  • Web server Apache 2.4.41
  • PHP version 7.3.10
@michalsn
Copy link
Member

I think this behavior is ported from CI3 and in such cases we should use text helper and it's convert_accented_characters() function.

I don't know if there are any contraindications, but I'd love to see this function that converts accented characters also inside the url_title() function. I usually create my own "url_title" function just to use those two functions together easier.

@MGatner
Copy link
Member

MGatner commented Oct 11, 2019

I like the idea, but diacritics are also legal URL characters and in some locales may be necessary to distinguish one word from another. I think the original issue is an unexpected return (capital diacritics not returning their equivalent lower case). I hate to add yet another parameter - is it that inconvenient to call both functions when that's the desired return?

@michalsn
Copy link
Member

After some thoughts - yet another parameter added to this function probably won't change much because it will be added at the end... so I guess calling both functions separately is the right choice.

@MGatner
Copy link
Member

MGatner commented Oct 11, 2019

Fixed by #2325

@MGatner MGatner closed this as completed Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants