danielstjules / Stringy

A PHP string manipulation library with multibyte support
MIT License
2.46k stars 216 forks source link

Localization problem #116

Closed ozgurkaragoz closed 7 years ago

ozgurkaragoz commented 8 years ago

Hi,

I'am using laravel 5.2.5 and this package using small part codes of Stringy. I have problem with some Turkish character (ö, Ö, ü, U) converting to slug.

For example in Turkish Language:

'Ö' => 'O', 'ö' => 'o',

in German or etc

'Ö' => 'OE', 'ö' => 'oe',

It is really big problem. (for information: https://en.wikipedia.org/wiki/%C3%96)

Converting process must be by localization.

Here laravel issue: https://github.com/laravel/framework/issues/11619

lucasmichot commented 8 years ago

@kaptanblack This seems to be a laravel 5.2 issue then

danielstjules commented 8 years ago

Nope, this is indeed an issue with Stringy. toAscii will need to be rewritten to take into account target locale.

And sorry for the late reply @kaptanblack, appreciate you raising the issue!

lucasmichot commented 8 years ago

Well Stringy is no longer included with Laravel >= 5.2 https://laravel.com/docs/5.2/upgrade So my misunderstanding

danielstjules commented 8 years ago

See here: https://github.com/laravel/framework/issues/11619#issuecomment-167989002 Nonetheless, it's still a problem with Stringy itself, even if it was discovered via Laravel.

mertkahyaoglu commented 7 years ago

Is this fixed or something? Because I'm suffering from this as well.

blackfyre commented 7 years ago

The Hungarian string conversion suffers from the same problems:

ö => oe ü => ue

Also while link to Stringy was removed, Laravel still very much relies on it, as stated by Graham on the issue laravel/framework#16622

hocza commented 7 years ago

Unlike the O-umlaut, the letter Ö cannot be written as "oe". Minimal pairs exist between 'ö' and 'oe' (and also with 'oo', 'öö' and 'öe'). Consider Finnish eläinkö "animal?" (interrogative) vs. eläinkoe "animal test" (cf. Germanic umlaut). If the character Ö is unavailable, O is substituted and context is relied upon for inference of the intended meaning.

source: https://en.wikipedia.org/wiki/Ö

It can also create many misunderstanding also in Turkish, Hungarian...

So, because of "one language", 8 and more others should not suffer from this.

So please move the 'ö' from "oe" back to "o" as it was before 2015 december

blackfyre commented 7 years ago

Things for ü are very similar as well: https://en.wikipedia.org/wiki/Ü

blackfyre commented 7 years ago

@danielstjules Can we get an update on this?

hocza commented 7 years ago

Bump

danielstjules commented 7 years ago

As previously mentioned, this method will require a complete rewrite to be locale-aware. Coming up on the holidays, should have some time off to tackle this.

danielstjules commented 7 years ago

https://github.com/danielstjules/Stringy/pull/159 :)

danielstjules commented 7 years ago

A solution to this issue will land in v3 via https://github.com/danielstjules/Stringy/pull/160 :)

blackfyre commented 7 years ago

@danielstjules thank you for your hard work!

danielstjules commented 7 years ago

A fix has been merged in master and a new major will be published soon :) Please see the changelog when done, as a couple breaking changes have been included with this release. Thanks for your patience!