The tag param is currently specified in the grammar as being a regular UTF-8 percent-encoded query parameter of any length.
tag-param = "tag=" *qchar
Yet in IOTA's reference libraries, a tag is a tryte-encoded string of max 27 trytes (eg. iota.lib.js).
The message doesn't have a maximum length (if longer than 2187 trytes, it will be fragmented and stored across multiple transactions in the bundle), so it can safely be a regular UTF-8 string of any length, later to be percent-decoded and tryte-encoded by the wallet.
But the tag's maximum length makes things more complicated, especially with percent-encoded UTF-8 characters. How to specify the max length then, so that it corresponds to 27 trytes?
I see two options…
Require that the tag is represented as UTF-8, but once percent-decoded and tryte-encoded, must be maximum 27 trytes.
\
This complicates creating URIs with tags somewhat, as the length of the raw (not percent-encoded) tag should be checked before percent-encoding (16 bytes = 27 trytes) to avoid it being truncated.
\
It also complicates using a tag that is intended to be consumed as trytes (eg. FOO is a valid tryte tag, but if provided as FOO in UTF-8, it will get tryte-encoded into PBYBYB when added to the transaction – not what one might expect).
Require that the tag must be specified as 27 trytes.
\
This means that one can't write URIs by hand with tags in UTF-8 (eg. This is a tag), it must first be tryte-encoded (into CCWCXCGDEAXCGDEAPCEAHDPCVC), and the tag's plain-text value will be obfuscated.
The
tag
param is currently specified in the grammar as being a regular UTF-8 percent-encoded query parameter of any length.Yet in IOTA's reference libraries, a tag is a tryte-encoded string of max 27 trytes (eg. iota.lib.js).
The message doesn't have a maximum length (if longer than 2187 trytes, it will be fragmented and stored across multiple transactions in the bundle), so it can safely be a regular UTF-8 string of any length, later to be percent-decoded and tryte-encoded by the wallet.
But the tag's maximum length makes things more complicated, especially with percent-encoded UTF-8 characters. How to specify the max length then, so that it corresponds to 27 trytes?
I see two options…
Require that the tag is represented as UTF-8, but once percent-decoded and tryte-encoded, must be maximum 27 trytes. \ This complicates creating URIs with tags somewhat, as the length of the raw (not percent-encoded) tag should be checked before percent-encoding (16 bytes = 27 trytes) to avoid it being truncated. \ It also complicates using a tag that is intended to be consumed as trytes (eg.
FOO
is a valid tryte tag, but if provided asFOO
in UTF-8, it will get tryte-encoded intoPBYBYB
when added to the transaction – not what one might expect).Require that the tag must be specified as 27 trytes. \ This means that one can't write URIs by hand with tags in UTF-8 (eg.
This is a tag
), it must first be tryte-encoded (intoCCWCXCGDEAXCGDEAPCEAHDPCVC
), and the tag's plain-text value will be obfuscated.Any other options? Ideas? Feedback?