Skip to content

slug() crop string #36880

Closed
Closed
@edguar

Description

@edguar

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions