This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html Multipage: http://www.whatwg.org/C#common-parser-idioms Complete: http://www.whatwg.org/c#common-parser-idioms Comment: Clarify what the code-point length of a string with isolated surrogate is. Posted from: 114.43.115.245 by kennyluck@csail.mit.edu User agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; ja-jp) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4
Assuming the intension of the current text is to count "\ud840\udc87" // as code-point length = 1 "\ud840+\udc87" // as code-point length = 3 (which isn't very clear as far as I can tell), I would suggest the spec to include a sentence like "Unpaired surrogates count as one code point each." (wording from [1]) Alternatively, it might be clearer to replace the sentence # The code-point length of a string is the number of Unicode code points in that string. by | The code-point length of a string is the number of Unicode characters after the string is converted to a sequence of Unicode characters[2]. This will then work for both a string of Unicode characters(theory) and a DOMString(reality), before the internal representation of the value of an input element[3] is made clear. Having said that, I am not convinced that defining @maxlength this way is the best, I tried to analyze other possibilities[4] but wasn't confident enough to file a bug (my preference is to count 16 bits) [1] http://download.oracle.com/javase/1,5.0/docs/api/java/lang/String.html (definition of String.codePointCount) [2] http://dev.w3.org/2006/webapi/WebIDL/#dfn-obtain-unicode [3] http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#concept-fe-value [4] http://lists.w3.org/Archives/Public/www-international/2011AprJun/0105
Yeah this is fallout from the decision to stop having the spec be in terms of Unicode but instead have the spec in terms of UTF-16 code points. Sigh. I'll need to fix this definition somehow.
Web IDL will probably introduce the term "code units" for 16-bit code units. I think all our specifications should use that and we should just accept they are not exactly ideal I think.
I use the term "element", following ES: http://es5.github.com/#x8.4 But that's admittedly quite confusing, even though I xref it, so someplace defining "code unit" would be nice.
I just added http://dev.w3.org/2006/webapi/WebIDL/#dfn-code-unit, if that is helpful.
Thanks, I switched over to using that: http://aryeh.name/gitweb.cgi?p=editing;a=commitdiff;h=73d8d864
Checked in as WHATWG revision r6633. Check-in comment: Redefine code-point length in terms of UTF-16 16bit code units. http://html5.org/tools/web-apps-tracker?from=6632&to=6633
This affects all manner of algorithms. I'm not even sure what I want for some of them. I'm pretty sure I don't want everything to work with code units rather than characters... I still have to add an xref for code unit; I also have to figure out what to do for a lot of these cases. I guess I need to define that isolated surrogates in a Unicode string are considered as being characters too, or something (with their code point being the value of the surrogate).
Checked in as WHATWG revision r6648. Check-in comment: Try to tidy up some more of the Unicode/code unit mess with a probably over-reaching definition (there's over 2000 uses of the word 'character' in the text, so I didn't check that all of them use this new definition... hopefully it works out; otherwise, we'll just have to try something else again). http://html5.org/tools/web-apps-tracker?from=6647&to=6648
Checked in as WHATWG revision r6649. Check-in comment: Define 'code unit'. http://html5.org/tools/web-apps-tracker?from=6648&to=6649
Checked in as WHATWG revision r6650. Check-in comment: Define 'Unicode code point'. http://html5.org/tools/web-apps-tracker?from=6649&to=6650
Checked in as WHATWG revision r6651. Check-in comment: Reorder the definitions and fix them so that they aren't cyclic. http://html5.org/tools/web-apps-tracker?from=6650&to=6651
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document: http://dev.w3.org/html5/decision-policy/decision-policy.html Status: Accepted Change Description: see diff given below Rationale: Ok I think I'm done here.