On encodings: Americans: "I don't want to know"; Japanese: "How can you not know?!"; Europeans: "Unicode solves everything"
the TLDR is that strings have a tagged encoding. Binary is an encoding. Incompatible encodings produce errors.pic.twitter.com/A5V4Ghm4UC
-
-
the default encoding is picked up from the locale, but Rails sets it to UTF-8, which impacts File IO.
-
All operations allow you to optionally specify an encoding.
-
The legacy C string APIs create BINARY strings, but the new APIs have an encoding parameter.
-
there is a configuration called "default internal encoding", which Rails sets to UTF-8. Libraries trancode to that 1/
-
after tagging the original string with the right encoding. 2/2
-
For compatibility with Ruby 1.8, Ruby also allows concatenating ASCII compatible encodings with only-low-bit ASCIIpic.twitter.com/oG4benoX3Y
-
I think Ruby 3.0 should remove this exception (it has real-world problems) but compare this to the Py3 design ;)
-
This is basically why Ruby and Python both did a unicode overhaul; the Ruby community moved on, Py transition no bueno
- 3 more replies
New conversation -
-
-
Ooh, that's novel to me! Do you prefer this model over Python-style 'unicode is an abstract data type'?
-
I both prefer it as a model and prefer actually being able to use Ruby 1.9+ for the past 5 years ;)
-
Intriguing! :) Apart from the graceful migration with Ruby 1.9+, why do you like it?
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.