I18N-ISSUE-496: note about character counts ??? [find-text]

I18N-ISSUE-496: note about character counts ⓟ [find-text]

http://www.w3.org/International/track/issues/496

Raised by: Addison Phillips
On product: find-text

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.

Received on Thursday, 15 October 2015 22:05:02 UTC