Slugify not working with chinese characters
yelnyafacee opened this issue · 5 comments
i tried $slugify->slugify('活动日起');
but it always return ""
how can I convert it into pinyin?
Also for me
Trying to translate any Chinese string, the result is always an empty string.
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.
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.
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?
I think you could use
$slugify->activateRuleSet(['default', 'german', 'chinese'])
->slugify('活动日起');
specifying all yout activable languages and their ordering