Comments (1)
atjson currently uses UTF-16 code points per the ecmascript String
type, so unicode-equivalent texts that use different unicode normalization (or unnormalized texts) are treated as entirely separate documents.
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 insertText
and deleteText
methods), the system is internally consistent and specifying behaviour for this is unnecessary.
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 contentMimeType
document attribute (or similar). This could be used to specify the mime-type of the content
(and give a path to automatic handling of normalization, string offset behaviours, etc). One challenge with this approach is that while it's possible to specify a charset
in addition to text/plain
(e.g. "text/plain; charset=UTF-16") per RFC2231, I'm not aware of any standardized way to specify unicode normalization in a content type (my understanding is that charset
in mime types must be one of the IANA registered types, none of which include normalization approaches)
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.
from atjson.
Related Issues (20)
- Dependency Dashboard
- Experiment with converters as renderers HOT 2
- Only short close HTML tags that are valid to short close
- Unicode whitespace is stripped from leading and trailing positions in markdown paragraphs
- Define Schema interface HOT 1
- Project-wide integration tests
- Index annotations by type to speed up `where` queries that check the type HOT 1
- Write schema interface
- Add efficient method for annotation class comparison, "is"
- Deficient Complex Boundary Behaviour HOT 2
- Extract out performance profiling into its own repository HOT 1
- Add cumulative performance time to performance profile summary HOT 1
- Remove the concept of "tight" lists HOT 1
- Remove commented-out code
- Natural/native renderers
- Nested lists are flattened when converting from gdocs paste source HOT 4
- Tombstoned attributes
- Add pandoc source and renderer HOT 2
- Add formal specification of atjson format
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from atjson.