Mastering Ruby Strings and Encodings
Walk away an expert!
- By manipulating individual bytes you'll gain a better understanding of how encodings work. You'll also be better equipped to debug strings.
- You may have used Unicode and UTF-8 but do you know the difference? Understand what they are and how the most popular encoding in the world works.
- Not only learn about UTF-8 but know enough to work with any encoding you run across. Understand what code points are and how to use them.
- What are normalization forms? How do you work with them? And why are they important?
- Learn about the different methods for creating strings. Find out why you should use one over another. You'll see helpful methods like %q and *. Get the entire story about how best to use heredocs.
- Should your object provide an implicit string conversion or only explicit? Learn the difference between to_s and to_str.
- Become an expert in immutable strings via freezing them. Find out why immutable strings are useful and why it might become the new normal in Ruby 3.0.
- Go beyond common methods so that you know the best method to use at any given moment. You'll see how gsub is overused and how methods like delete and tr can be better.
- Explore advanced solutions like using Encoding::Converter to fix invalid characters within a string.