-
Notifications
You must be signed in to change notification settings - Fork 7
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
note about character counts [I18N-ISSUE-496] #4
Comments
Indeed that the (a) is an appropriate and an ideal solution, definitely, but I can't find strong reasons to make FindText API isolated from other HTML APIs, especially from Range Object. |
@tkanai you make a good point that we have to align on what current HTML API-s, ie, current browsers do. If we get to the point where browsers would implement this (or part of it), that alignment becomes crucial. I have no idea (and nobody knows in detail, I guess) where ES7 will go; we can make an update of the spec if that change really occurs. B.t.w., I wonder whether this note does not also affects the editing distance. |
Here are the test results of newly introduced String functions in ES6.
Not good. I was expecting code-point basis indexing for codePointAt(). It appears to me it is still on code-unit basis indexing. Regarding Editing distance, I think codePointAt() would work for it, but it calls for a custom indexing which shifts index in case an obtained code is in specific ranges, such as codes in Low Surrogate. |
http://www.w3.org/International/track/issues/496 [I18N-ISSUE-496]
http://www.w3.org/TR/2015/WD-findtext-20151015/#introduction
In the introduction there is this note:
For character counts in ranges, what exactly would be counted as a character? Unicode code points? Graphemes?
This is an important distinction.
I would suggest that the most commonly needed offset will be either in (a) Unicode code points or (b) in UTF-16 code units.
The latter would be best for JavaScript and DOM access, which are based on UTF-16 and thus would allow direct application of APIs such as substring().
The former would be better from a pure API perspective and for computing things such as string length in "characters".
Grapheme clusters can be complex and, while APIs may wish to find grapheme boundaries or to avoid splitting withing a grapheme , it is rarely the case that API access should be in these terms. Indeed, in some cases, it may be desirable to find text withing a grapheme and not the entire thing.
The text was updated successfully, but these errors were encountered: