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

Slugify not working with chinese characters #205

Open
yelnyafacee opened this issue Jun 5, 2018 · 5 comments
Open

Slugify not working with chinese characters #205

yelnyafacee opened this issue Jun 5, 2018 · 5 comments

Comments

@yelnyafacee
Copy link

i tried $slugify->slugify('活动日起');

but it always return ""

how can I convert it into pinyin?

@f-liva
Copy link

f-liva commented Jun 11, 2018

Also for me

Trying to translate any Chinese string, the result is always an empty string.

@f-liva
Copy link

f-liva commented Jun 11, 2018

I just noticed one interesting thing...

$slugify->slugify('活动日起');

It returns an empty string, but...

$slugify->activateRuleSet('chinese')
        ->slugify('活动日起');

It correctly returns huodongriqi that is the expected output.

I therefore think that there is a problem with the automatic detection of Chinese. The string is not recognized and therefore the output is not provided.

@f-liva
Copy link

f-liva commented Jun 11, 2018

Ok @yelnyaface this is not a bug.

The documentation expressly states that, for obvious reasons, not all rules are active by default, because conflicts would arise.

It is therefore right that the Chinese must be activated before it is used.

@yelnyafacee
Copy link
Author

yes, but it is hard to know when to expect chinese characters

->activateRuleSet('chinese') works, but one needs to know when to expect chinese characters,

is there some way to detect the charset so activateRuleSet('chinese') can be used?

@f-liva
Copy link

f-liva commented Jun 11, 2018

I think you could use

$slugify->activateRuleSet(['default', 'german', 'chinese'])
        ->slugify('活动日起');

specifying all yout activable languages and their ordering

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

2 participants