RESP3 icon indicating copy to clipboard operation
RESP3 copied to clipboard

Text type?

Open coleifer opened this issue 6 years ago • 5 comments

I wonder what you think of adding a dedicated text type, which would be identical to the bulk-string, but would indicate UTF8-encoded unicode text as opposed to an arbitrary blob of bytes?

The difference to the client would be equivalent to how Python 3 differentiates str (for unicode) and bytes (for blobs). I think msgpack has something similar.

Or perhaps this is the intended use-case for the "verbatim string" type?

coleifer avatar Dec 21 '18 19:12 coleifer

I'm a little confused as to the exact use of the verbatim string. I'd assume it is for the same case you're describing, but clarification and perhaps standardisation on an encoding (i.e. UTF-8) would be useful to prevent weird issues. That being said, would it be OK to use non-printing characters (like unicode modifier chars) or terminal colour codes in a verbatim type reply?

AngusP avatar Jan 02 '19 19:01 AngusP

Perhaps adding a third bin to the verbatim types (existing are mkd for Markdown and txt for text) wto be used for verbatim strings containing things lime images or other blobs, and require that mkd and txt be UTF-8 (or at least printable non-weirdness).

AngusP avatar Jan 03 '19 10:01 AngusP

Bulk strings are binary safe, there's no need for that.

coleifer avatar Jan 03 '19 13:01 coleifer

Verbatim Strings and Bulk Strings would be equivalent in that case but it could be handy having a semantic difference between the two, and leaving verbatim strings still open to arbitrary use (if txt and mkd were constrained to UTF-8 strings)

AngusP avatar Jan 03 '19 13:01 AngusP

@antirez -- what do you think about a dedicated UTF8-encoded text type? For us Python users this would mean correct handling of str vs bytes, which would be very very nice.

coleifer avatar Jan 25 '19 16:01 coleifer