Code & Clay – Notes to self. Mainly Ruby/Rails.

Unicode null

Unicode has a character that represents null.

It is used to represent the end of a string but could also be used when a placeholder character is required. Perhaps as padding, differentiating from ' '.

In Ruby, 0.chr evaluates to the Null character.

There is a can of worms called Null Byte Injection associated with this character.

If you really want to get to grips with Ruby development and gain a solid understanding of Object Oriented Design, I thoroughly recommend Sandi Metz's Practical Object Oriented Design in Ruby. It's the perfect introduction to OOP and pragmatic Ruby. You can buy it here.

“Meticulously pragmatic and exquisitely articulate, Practical Object Oriented Design in Ruby makes otherwise elusive knowledge available to an audience which desperately needs it. The prescriptions are appropriate both as rules for novices and as guidelines for experienced professionals.”

Katrina Owen, Creator, Exercism

Essential Reading: Learn Rails 6