4 ms·
Personally, I prefer Ruby's behavior of explicit encoding on strings and being very cranky when invalid codepoints show up in a UTF-8 string. If you want to ig
by kayodelycaon 2y ago
Personally, I prefer Ruby's behavior of explicit encoding on strings and being very cranky when invalid codepoints show up in a UTF-8 string.
If you want to ignore invalid UTF-8, use String#scrub to replace heretical values with \uFFFD and life is good. :)
- adgjlsfhk1 2y agolife is good until you try to read a file path that is not a valid string and discover that you read the wrong file.
- kayodelycaon 2y agoDefinitely and that’s what ASCII-8BIT is for. You’ll get out exactly what you put in. :) Also, the “life is good” was somewhat sarcastic.