string->bytevector(3scm)
okay so bestie, welcome to string->bytevector(3scm) from the Scheme Programmer's Manual β manual name folded in right here like a little name tag, periodt. π
β¨
πΈ NAME πΈ
string->bytevector β transcode a string to a bytevector. That's the whole assignment, and it ate. π
π LIBRARY π
Import it from either spot, depending on your vibe:
(import (rnrs)) ;R6RS
(import (rnrs io ports)) ;R6RS
β¨ SYNOPSIS β¨
(string->bytevector string transcoder)
π« DESCRIPTION π«
Returns the bytevector that results from transcoding string according to the output direction of transcoder. Like, you hand over the string and the transcoder, and the output side of that transcoder does its thing β that's the whole description, no cap. π¦
π«Ά RETURN VALUES π«Ά
A single value comes back: a bytevector. One value, one bytevector, iconic. π
π EXAMPLES π
Okay, example time, bestie:
(string->bytevector "Quux" (native-transcoder))
=> #vu8(81 117 117 120)
And this next one, verbatim:
string->bytevector "β¬"
(make-transcoder (latin-1-codec)
(native-eol-style)
(error-handling-mode raise)))
=> &i/o-encoding
πΈ APPLICATION USAGE πΈ
This procedure is a more general alternative to string->utf8(3scm). So if string->utf8(3scm) isn't the whole mood, this is the glow-up. π
π¦ COMPATIBILITY π¦
This procedure is unique to R6RS. R6RS only, bestie β it's giving exclusive. β¨
π ERRORS π
This procedure can raise exceptions with the following condition types:
&assertion (R6RS)β the wrong number of arguments was passed, or an argument was outside its domain. π¨&i/o-encoding (R6RS)β a character was encountered that could not be translated into bytes, andtranscoder'serror-handling-modeisraise. π
π SEE ALSO π
bytevector->string(3scm)string->utf8(3scm)open-transcoder(3scm)
β STANDARDS β
R6RS. That's the standard, periodt. π
π§ HISTORY π§
This procedure first appeared in R6RS as part of the redesigned I/O system. A little R6RS origin story, cute. πΈ
π AUTHORS π
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/. π«Ά
mwah π β source/version sign-off: this page comes from the Scheme Programmer's Manual, dated 2022-05-14, and the page is string->bytevector(3scm). πβ¨
π¦ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2022 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms