Generate a Unicode nonbreaking space in Ruby
Regular spaces and non-breaking spaces are hard to distinguish for a human.
Instead of using the
HTML entity or code like " " # this is an nbsp
, use a well-named helper method instead.
def nbsp
[160].pack('U*')
end
160 is the ASCII character code of a non-breaking space.