8000 slug() crop string · Issue #36880 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

slug() crop string #36880

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

Closed
edguar opened this issue May 20, 2020 · 0 comments
Closed

slug() crop string #36880

edguar opened this issue May 20, 2020 · 0 comments

Comments

@edguar
Copy link
edguar commented May 20, 2020

Symfony version(s) affected: 5.0.*

Description
slug() crop string after some symbols if ICONV_IMPL === 'glibc'

How to reproduce

public function __construct(SluggerInterface $slugger) {
    $slug = $slugger->slug('Отель Отель')->lower(); // 'Ote'
    $slug = $slugger->slug('ль Отель')->lower(); // ''
    $slug = $slugger->slug('Рь Отель')->lower(); // ''
}

Possible Solution
AbstractUnicodeString.php

} elseif (ICONV_IMPL === 'glibc') {
    $s = iconv('UTF-8', 'ASCII//TRANSLIT', $s);
} else {

change to

} elseif (ICONV_IMPL === 'glibc') {
    $s = iconv('UTF-8', 'ASCII//IGNORE//TRANSLIT', $s);
} else {

Additional context

@edguar edguar added the Bug label May 20, 2020
@xabbuh xabbuh added the String label May 20, 2020
@fabpot fabpot closed this as completed Sep 16, 2020
fabpot added a commit that referenced this issue Sep 16, 2020
…ions of iconv() (nicolas-grekas)

This PR was merged into the 5.1 branch.

Discussion
----------

[String] improve slugger's portability accross implementations of iconv()

| Q             | A
| ------------- | ---
| Branch?       | 5.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #36880, fix #38060
| License       | MIT
| Doc PR        | -

Ping @Surfoo @edguar, can you please confirm that this fixes your issues?

Commits
-------

21e4e32 [String] improve slugger's portability accross implementations of iconv()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
0