(zettel (meta (back "00001012920500") (backward "00001012920500") (box-number "1") (created "20260303142542") (forward "00001012920516 00001012921200 00001012930000") (modified "20260303163611") (published "20260303163611") (role "manual") (syntax "zmk") (tags "#api #manual #reference #zettelstore") (title "Data Encoding")) (rights 4) (encoding "") (content "The data encoding represents the zettel as a special [[symbolic expression|00001012930000]].\nIn contrast to the similar-looking [[sz encoding|00001012920516]], a much simpler structure is used.\n\nIf transferred via HTTP, the content type will be ''text/plain; charset=utf-8''.\n\nA full zettel, both metadata and content, is encoded by the list\n\n:::syntax\n''(zettel'' [[__Metadata__|#metadata]] [[__Access rights__|#access-rights]] [[__Content encoding__|#content-encoding]] [[__Content__|#content]] '')''.\n:::\n\nIf you only want to encode the metadata of a zettel, the following format will be used:\n\n:::syntax\n''(list'' [[__Metadata__|#metadata]] [[__Access rights__|#access-rights]] '')''.\n:::\n\n=== Metadata\nMetadata is basically a sequence of key / value pairs:\n\n:::syntax\n__Metadata__ **=** ''(meta'' ''('' __Key__ __Value__ '')'' … '')''.\n\n__Key__ **=** Symbol.\n\n__Value__ **=** String. \n:::\n\nEach __Key__ is a symbol, derivied from the metadata key.\nThe __Value__ is a string containing the value of the corresponding metadata entry.\n\n=== Access rights\nThis element encodes [[access rights|00001012921200]] of a zettel:\n\n:::syntax\n__Access rights__ **=** ''(rights'' Number '')''.\n:::\n\n=== Content encoding\nThe content encoding specifies, how the zettel content is encoded.\nCurrently, two values are supported: the empty string and the string ''\"base64\"''.\n\n:::syntax\n__Content encoding__ **=** ''(encoding \"\")'' **|** ''(encoding \"base64\")''. \n:::\n\nThe empty string indicates that the content is not encoded and can be used as is.\n''\"base64\"'' indicates that the content string is Base64-encoded (typically used for binary content).\n\n=== Content\nThe content of a zettel is always encoded as a readable string.\nFor binary content, it is first encoded using Base64.\n\n:::syntax\n__Content__ **=** ''(content'' String '')''.\n:::"))