Skip to content

Commit 17436dc

Browse files
committed
rfc24: add optional encoding override in data events
Problem: It is unnecessarily restrictive to require that all data events for a particular stream are bound to a single encoding. Allowing the encoding to be overridden per-event would allow easy escaping of invalid characters on a per-event basis. Knowledge that a data stream cannot be encoded using the header-specified encoding may not be known until runtime, at which point it is too late to go back and change the encoding type. Specify that any encoding specified in the header event is the "default" encoding for a stream, implying that the encoding might be overridden. Allow an optional "encoding" key in the data context object. If set, this encoding will be considered to override the default encoding for that stream, and will apply to the current data event only.
1 parent 94f34ee commit 17436dc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

spec_24.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ version
8383

8484
encoding
8585
(object) A dictionary mapping stream names (e.g. ``stdin``, ``stdout``, ``stderr``)
86-
to encoding type (e.g. ``base64``, ``UTF-8``).
86+
to default encoding type (e.g. ``base64``, ``UTF-8``).
8787

8888
count
8989
(object) A dictionary mapping stream names (e.g. ``stdout``, ``stderr``)
@@ -146,6 +146,12 @@ data
146146
eof
147147
(boolean) End of stream indicator.
148148

149+
The following keys are OPTIOINAL in the event context object:
150+
151+
encoding
152+
(string) The encoding of this particular data event when different from
153+
the default encoding specified by the header event.
154+
149155
The context object SHOULD contain either a ``data`` or ``eof`` key, or both.
150156

151157
Example:

0 commit comments

Comments
 (0)