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 fail for long string of other language e.gMarathi,Hindi,kannada etc..... #83

Closed
sharvarilimbkar opened this issue Oct 29, 2015 · 9 comments

Comments

@sharvarilimbkar
Copy link

for this msg
11:50AM - बांगलादेशमध्ये सलग तिसऱ्या वर्षी आशिया कप टी-ट्वेंटी स्पर्धेचे आयोजन करण्यात आले असून २४ फेब्रुवारी ते ६ मार्च दरम्यान ही स्पर्धा होणार आहे.
11:46AM - नगरमध्ये त्रिमूर्ती कॉलेजमधील १२ वीच्या विद्यार्थीनीची आत्महत्या, वर्गातच लावून घेतला गळफास
11:38AM - बँकॉकमधील नृत्यस्पर्धेसाठी मुख्यमंत्र्याकडून देण्यात आलेला ८ लाख रुपयांचा निधी कलावंतांनी परत दिला आहे.11:50AM - बांगलादेशमध्ये सलग तिसऱ्या वर्षी आशिया कप टी-ट्वेंटी स्पर्धेचे आयोजन करण्यात आले असून २४ फेब्रुवारी ते ६ मार्च दरम्यान ही स्पर्धा होणार आहे.
11:46AM - नगरमध्ये त्रिमूर्ती कॉलेजमधील १२ वीच्या विद्यार्थीनीची आत्महत्या, वर्गातच लावून घेतला गळफास
11:38AM - बँकॉकमधील नृत्यस्पर्धेसाठी मुख्यमंत्र्याकडून देण्यात आलेला ८ लाख रुपयांचा निधी कलावंतांनी परत दिला आहे.11:50AM - बांगलादेशमध्ये सलग तिसऱ्या वर्षी आशिया कप टी-ट्वेंटी स्पर्धेचे आयोजन करण्यात आले असून २४ फेब्रुवारी ते ६ मार्च दरम्यान ही स्पर्धा होणार आहे.
11:46AM - नगरमध्ये त्रिमूर्ती कॉलेजमधील १२ वीच्या विद्यार्थीनीची आत्महत्या, वर्गातच लावून घेतला गळफास
11:38AM - बँकॉकमधील नृत्यस्पर्धेसाठी मुख्यमंत्र्याकडून देण्यात आलेला ८ लाख रुपयांचा निधी कलावंतांनी परत दिला आहे.11:50AM - बांगलादेशमध्ये सलग तिसऱ्या वर्षी आशिया कप टी-ट्वेंटी स्पर्धेचे आयोजन करण्यात आले असून २४ फेब्रुवारी ते ६ मार्च दरम्यान ही स्पर्धा होणार आहे.
11:46AM - नगरमध्ये त्रिमूर्ती कॉलेजमधील १२ वीच्या विद्यार्थीनीची आत्महत्या, वर्गातच लावून घेतला गळफास
11:38AM - बँकॉकमधील नृत्यस्पर्धेसाठी मुख्यमंत्र्याकडून देण्यात आलेला ८ लाख रुपयांचा निधी कलावंतांनी परत दिला आहे.11:50AM - बांगलादेशमध्ये सलग तिसऱ्या वर्षी आशिया कप टी-ट्वेंटी स्पर्धेचे आयोजन करण्यात आले असून २४ फेब्रुवारी ते ६ मार्च दरम्यान ही स्पर्धा होणार आहे.
11:46AM - नगरमध्ये त्रिमूर्ती कॉलेजमधील १२ वीच्या विद्यार्थीनीची आत्महत्या, वर्गातच लावून घेतला गळफास
11:38AM - बँकॉकमधील नृत्यस्पर्धेसाठी मुख्यमंत्र्याकडून देण्यात आलेला ८ लाख रुपयांचा निधी कलावंतांनी परत दिला आहे.11:50AM - बांगलादेशमध्ये सलग तिसऱ्या वर्षी आशिया कप टी-ट्वेंटी स्पर्धेचे आयोजन करण्यात आले असून २४ फेब्रुवारी ते ६ मार्च दरम्यान ही स्पर्धा होणार आहे.
11:46AM - नगरमध्ये त्रिमूर्ती कॉलेजमधील १२ वीच्या विद्यार्थीनीची आत्महत्या, वर्गातच लावून घेतला गळफास
11:38AM - बँकॉकमधील नृत्यस्पर्धेसाठी मुख्यमंत्र्याकडून देण्यात आलेला ८ लाख रुपयांचा निधी कलावंतांनी परत दिला आहे.11:50AM - बांगलादेशमध्ये सलग तिसऱ्या वर्षी आशिया कप टी-ट्वेंटी स्पर्धेचे आयोजन करण्यात आले असून २४ फेब्रुवारी ते ६ मार्च दरम्यान ही स्पर्धा होणार आहे.
11:46AM - नगरमध्ये त्रिमूर्ती कॉलेजमधील १२ वीच्या विद्यार्थीनीची आत्महत्या, वर्गातच लावून घेतला गळफास
11:38AM - बँकॉकमधील नृत्यस्पर्धेसाठी मुख्यमंत्र्याकडून देण्यात आलेला ८ लाख रुपयांचा निधी कलावंतांनी परत दिला आहे.

i am using cocur/slugify in laravel 5.1
so It fail at this line for above msg
preg_replace($this->regExp, $separator, $string);

@mac2000
Copy link
Contributor

mac2000 commented Oct 29, 2015

Seems that slugify do not have rules for that language (btw what language it is?).

Can you provide rules for transliteration? And some examples so we could make a pull request from it?

@florianeckerstorfer
Copy link
Member

@sharvari1 Slugify currently does not support Marathi, Hindi or Kannada (as @mac2000 mentioned we would appreciate it if you could provide transliterations for these).

Do you mean that the transliteration fail because it produces not the desired result or does it produce an PHP error or exception. If there is an error or exception could you please provide the following:

  • Exact error message (and stack trace if available)
  • Exact PHP version
  • Exact Slugify version

@mac2000
Copy link
Contributor

mac2000 commented Oct 29, 2015

Have checked - symbols are removed, only digits left, e.g. $slugify->slugify('11:50AM - बांगलादेशमध्ये सलग तिसऱ्या वर्षी आशिया कप टी-ट्वेंटी स्पर्धेचे आयोजन करण्यात आले असून २४ फेब्रुवारी ते ६ मार्च दरम्यान ही स्पर्धा होणार आहे.') will produce 11-50am

@florianeckerstorfer
Copy link
Member

Thanks for checking this. Yes, we would need transliterations for these languages then.

For Hindi I found an alphabet which we could use: http://mylanguages.org/hindi_alphabet.php
But I could not find one for Marathi.

@sharvarilimbkar
Copy link
Author

Thanks for reply but
if msg in marathi language is small that time slugify work well (it gives proper result means it gives empty string )but for long msg of marathi language it fail

i am using php of version 5.4.14
and slugify version =^1.3

@florianeckerstorfer
Copy link
Member

Can you specify how it fails. For PHP 5.6 the original message you posted did produce a valid result based on the current set of rules.

@sharvarilimbkar
Copy link
Author

It directly terminate the execution of program for php 5.4.14

@florianeckerstorfer
Copy link
Member

According to the tests I added Slugify works fine with unknown unicode characters in PHP 5.4.37.

Can you try increasing PCRE backtrack limit? See http://www.karlrixon.co.uk/writing/php-regular-expression-fails-silently-on-long-strings/

@florianeckerstorfer
Copy link
Member

@Poojal123 Were you able to try increasing PCRE backtrack limit? Since we can't reproduce the bug I am closing this issue now. If you continue to have problems please reopen.

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

3 participants