Perl 6 Error Message: Invalid UTF-8 in <unit> Block
1 answer
If you do not specify the encoding when opening the file, it will accept utf8 . Apparently, the file you want to open contains bytes that cannot be interpreted as UTF-8. Hence the error message.
Depending on what you want to do with the contents of the file, you can either set the :bin named parameter to open the file in binary mode. Or you can use a special utf8-c8 encoding that will accept UTF-8 until it encounters bytes that it cannot encode: in this case, it will generate temporary code points.
See https://docs.perl6.org/language/unicode#UTF8-C8 for more details.
+9