News for hackers. Stuff that matters.
Re:Speed improvements in Python 3.7 by viraptor on Tuesday February 13, 2018 @08:07PM (#16372517)
I think this world exists in Ruby and as far as I can tell it fails worse in comparison. You end up in situations where 2 layers of gems don't care what they're passing through and operating on, then you get the result and can't tell anything useful about the contents. Was the encoding preserved? Is it even encoded?

People end up using hacks like https://github.com/whitequark/rack-utf8_sanitizer which shouldn't be necessary in the first place, because you should know whether you're receiving raw bytes or text. But what you thought was text that's utf8-compatible actually includes characters from another encoding.

`String.valid_encoding?` is probably the worst programming idea. If you have to ask that, it's too late. There should've been an exception raised when the input was initially processed, or the type should not pretend that it's a real text.

There are no comments on this comment yet.