Page 1 of 1

Bug fix - Suggest with utf8 accents éèà

Posted: Wed Mar 23, 2016 3:44 pm
by araviski
Script URL: I swear I have a licence ! (Private message me if required !)
Version of script: 2.6.5
Hosting company: myself
What terms did you try when SEARCHING for a solution: substr suggest mb_

Write your message below:

In knowledge base auto suggest, when using UTF8 characters such "éèà", if a character stored on multiple bytes is under the cut, this result in question mark like this Image

In order to fix it, in lines 93 and 97 of suggest_articles.php I use mb_substr function instead of substr.

If this fix is correct and if you can add it to next release this would be awesome.

Best regards

Araviski

Re: Bug fix - Suggest with utf8 accents éèà

Posted: Wed Mar 23, 2016 5:39 pm
by Klemen
This doesn't happen on my server (linux and windows) in any browser I test.

Did you type the article in another software (such as Word) and copy-paste it into HESK?

Re: Bug fix - Suggest with utf8 accents éèà

Posted: Tue Mar 29, 2016 10:33 am
by araviski
Thank your for your answer.

Accents are well presenting in suggest box 99% of time.

The problem occurs only when the text is cut under the accent character.

Here is a sample case :
http://stackoverflow.com/questions/1244 ... f-8-string

Re: Bug fix - Suggest with utf8 accents éèà

Posted: Tue Mar 29, 2016 11:14 am
by Klemen
Thanks for the info, will look into it and fix by checking for and using mb_string function instead if available.

Re: Bug fix - Suggest with utf8 accents éèà

Posted: Tue Mar 29, 2016 11:24 am
by Klemen
P.s. I still can't replicate it on my test servers to be able to test and confirm the fix.

Could you provide a sample article text that gets truncated like this please?

Re: Bug fix - Suggest with utf8 accents éèà

Posted: Sat Apr 02, 2016 5:38 am
by araviski
Hello Klemen,

Thank you very much for your help. I have more investigated and problem might come from utf8 text that was migrated from an old version of hesk. I did not succeed to reproduce it with brand new text (I guess a random accent bulk string such ééééééééééé....ééé could made the bug appears, but I did not succeed). Encoding is probably different.

While testing I discovered that html_entities are broken, but the bug is different. I'll try to prepare a fix for this one.
Image
Image

Best regards