5 ms·
Racket does this too. In Racket, "this is a string, which is a sequence of characters" #"this is a bytestring, a sequence of numbers between 0 and 255
by gcr 14y ago
Racket does this too.
In Racket,
"this is a string, which is a sequence of characters"
#"this is a bytestring, a sequence of numbers between 0 and 255"
You can convert back and forth with string->bytes/utf-8 or bytes->string/utf-8, substituting utf-8 for whichever character encoding you want.
You can use functions like string-ref, which returns a unicode character and bytes-ref, which returns an integer. Functions like string-normalize-nfc (or -nfd or -nfkc or etc) will normalize combining characters, and you can capitalize uppercase/lowercase strings according to locale, etc. Read from an input port with read-bytes and read-string, and writing to an output port works similarly.
Racket does does a great job keeping these things as explicit as they should be.