Scrollspy Doesn't Support Chinese ID Targets #10205

wzpan opened this Issue Aug 27, 2013 · 8 comments


None yet

5 participants

wzpan commented Aug 27, 2013

Hello, I found Scrollspy doesn't support Chinese ID Targets.

In order to reproduce the bug, I post a gist. It looks almost the same to the example from official Doc. A slight difference is that I modify one element's id("mdo") into a Chinese ID ("艾姆滴欧").

When you view the html file in your browser, you can see that it can spy all the target elements except that element with Chinese ID.


Sorry, we no longer support v2.x.x. You can ask for help on the mailing list though; see the README for a link.

@cvrebert cvrebert closed this Aug 27, 2013
wzpan commented Aug 27, 2013

To avoid raising a duplicate issue I will reply this one directly. The problem still exists in 3.0.
I've updated a new revision of this gist by using twitter-bootstrap 3.0. And the problem still remains.
Please check it again.


Please remove the docs CSS and upgrade the example to a JS Bin or JSFiddle.

@cvrebert cvrebert reopened this Aug 27, 2013
wzpan commented Aug 27, 2013

Done. Here's the example on JS Bin:,output

boulox commented Aug 27, 2013

Confirm came across this too, with Thai character

ianb commented Sep 5, 2013

Is this all due to : var $href = /^#\w/.test(href) && $(href) ? That is, \w won't match Chinese or other characters.

wzpan commented Sep 17, 2013

Thanks @ianb , it should be that reason! I have fixed it by extending the regexp so as to match Chinese and other characters and that works!

var $href = /^#[\u2e80-\u9fff\w]/.test(href) && $(href)

@boulox , please check whether Thai characters also works.

fat commented Dec 24, 2013

hm… yeah this was written with the old html4 stuff in mind

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

looks like html5 is much more chill with diff chars in id's tho

i'll push a fix in the next few min

@fat fat closed this in a87b150 Dec 24, 2013
@mdo mdo referenced this issue Dec 25, 2013

v3.1.0 ship list #11734

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment