On Tue, Oct 9, 2018 at 9:21 AM ToddAndMargo via perl6-users <
perl6-users@perl.org> wrote:

>
> Yes, I know there are other ways to read a file.  I
> have a specific reason for using `read`.
>
> How do I properly turn a Buf into a Str (all the bytes will
> have been tested to make sure they are printable first)?
>

If the characters are UTF-8 compatible, you can call $buf.decode on it to
decode it into characters (graphemes) that make up a Str.
If they are in some other encoding, and that encoding is supported, you can
pass that in to .decode()

https://docs.perl6.org/routine/decode

Curt

Reply via email to