kstenerud / concise-encoding

The secure data format for a modern world
https://concise-encoding.org
Other
258 stars 4 forks source link

"r" is for Resource Identifier? #24

Closed kengruven closed 3 years ago

kengruven commented 3 years ago

I read that "An empty array has a type but no contents: |type|", and type r means "Resource Identifier".

So |r| should be an empty list of resource identifiers? Or an empty resource identifier? I tried this:

$ echo 'c1 |r|' | ./enctool convert -df cbe|hexdump -C
00000000  03 00 94 e3 02 72 00                              |.....r.|
00000007

I got a valid document but it's something different. 94 e3 means second plane, type "media". "Media" seems to be a catch-all type for "arbitrary binary data plus a MIME-type (so long as it's distinct from any of CTE's built-in type abbreviations)".

I think what is going on is that Resource Identifier in CTE is delimited (only) by @" and ", and there's no array type (they're variable-width), so it doesn't really belong in CTE's "The following array types are available:" table. It's basically a special string, and string isn't in that table, either. Maybe |r http://example.com| was an old syntax, and this occurrence never got updated.

kstenerud commented 3 years ago

Whoops, left over cruft from when resource IDs were encoded that way (it's now @"blahblah").

"media" is the assumed type when the type field isn't recognized because IANA controls what are valid media types.

https://github.com/kstenerud/concise-encoding/commit/782ce25605fecac10f74a9511a8a981ac049aa22