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

Bug when searching non-ASCII languages #2821

Closed
ali1360 opened this issue May 29, 2017 · 5 comments · Fixed by #2877
Closed

Bug when searching non-ASCII languages #2821

ali1360 opened this issue May 29, 2017 · 5 comments · Fixed by #2877
Labels

Comments

@ali1360
Copy link

ali1360 commented May 29, 2017

hi
I am using chosen 1.7.0 JQuery in my asp.net MVC project. It works perfect in English, but in my case when I use chosen in multi-select mode for Persian language the search text shows just last charterer instead of whole word. i have work around it and found the problem happens in line 394 , 395 of "chosen.jquery.js" when creating tag.
no difference whether using rtl option or not the result is the same.
1
2

thanks in advance.

@aaltheiab2012
Copy link

Thank you, this helped me a lot
I had to remove ( .substr(startpos); ) from line 395 to fix the issue. i'm using Arabic.

@tjschuck
Copy link
Member

Based on #2819, it sounds like there might be a similar issue with Chinese (a regression in search between 1.6.2 and 1.7), so this might not be limited to RTL languages.

Based on the .substr(startpos) highlighted above, it might be a multi-byte char issue? That would affect a number of non-ASCII languages, not just RTL ones.

@evanre
Copy link

evanre commented Jul 19, 2017

Hi, I've got the same problem with cyrilic languages. Signed up on the topic and waiting for solution)

As temp solution, commented this string:
option.search_text = text.substr(0, startpos) + '<em>' + text.substr(startpos);

@tjschuck tjschuck changed the title Bug when searching rtl language Bug when searching non-ASCII languages Aug 28, 2017
@adunkman
Copy link
Contributor

adunkman commented Aug 29, 2017

Today I learned that \w and \b are ASCII-specific in JavaScript — they do not work for characters outside the ASCII character range.

I’m working on an alternative solution to #1483, but just wanted to post here because it was surprising news to me and thought you might be interested in learning, too!

@tjschuck
Copy link
Member

tjschuck commented Sep 5, 2017

This was fixed in #2877 and has been released as part of version 1.8.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants