the.bay.news

Failing to read a file due to it not being valid UTF-8

The Rust Programming Language Forum
Failing to read a file due to it not being valid UTF-8
This is some code I wrote (src/main.rs): let contents = fs::read_to_string("test.bf").unwrap(); however, when it runs, it panics due to the file not being valid UTF-8 despite the file being UTF-8 encoded. The character it claims is not valid is '.'. I printed out the bytes it read, one thing was odd: the file is only around 50 characters (all ASCII) long but the byte buffer was so big my terminal ended erasing some of the output due to it being so big (well over 10'000 bytes long). I am very c...

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.