In role Blob§
See primary documentation in context for method decode
multi method decode(Blob: = self.encoding // "utf-8")
multi method decode(Blob: , Str :!,Bool : = False)
multi method decode(Blob: , Bool : = False)
Applies an encoding to turn the blob into a Str
; the encoding will be UTF-8 by default.
my Blob = "string".encode('utf-8');say .decode('utf-8'); # OUTPUT: «string»
On malformed utf-8 .decode
will throw X::AdHoc. To handle sloppy utf-8 use utf8-c8
.