-
Notifications
You must be signed in to change notification settings - Fork 13
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
Unicode normalization of content #895
Comments
atjson currently uses UTF-16 code points per the ecmascript There are a couple of different possible ways to address this, but in practice, as long as text editors or tools using atjson do not normalize the content (or do so only using the For an interchange format where the underlying text might be subject to modification independently from the annotations, or environments where it's necessary or desirable to normalize the unicode content string without using the atjson interface (I'm not sure I can think of a realistic example, but happy for suggestions!), one possible approach would be to add a new That all said, so long as software that modifies an atjson document ensures that (1) the offsets align to UTF-16 code points per the ecmascript definition of strings and (2) any changes, e.g. unicode normalization, correctly update the offsets to account for any added or removed code points, then any other software operating on an atjson document would be able to correctly interpret and modify that document itself. In practical terms, the insertion or removal of a single code point via a normalization process would simply increase or reduce by one all annotation offsets greater than the insertion offset. The more complex case of normalization of a document with annotations that refer to code points within a composed character (i.e., grapheme) that is modified by normalization is an edge case that might warrant consideration, though we haven't yet encountered that use-case. My hunch is that any annotations that have start/end offsets within a unicode grapheme (i.e., not aligned to the start or end of the grapheme) would be unicode-specific annotations and as such could use the custom text insertion/deletion behaviours in order to implement the correct behaviour. |
What are the results of this discussion?
The character position within a Unicode string depends on whether the string is normalized and which Unicode normalization form is used. atjson should specify to normalize content strings to avoid character position mismatch and to ensure same content results in same character sequence.
When are two content strings assumed to be equivalent? Does atjson recommend or require Unicode normalization form and which?
I recommend NFC (Normalization Form Canonical Composition).
The text was updated successfully, but these errors were encountered: