Read more

Generate a Unicode nonbreaking space in Ruby

Arne Hartherz
November 09, 2010Software engineer at makandra GmbH

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
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

160 is the ASCII character code of a non-breaking space.

Posted by Arne Hartherz to makandra dev (2010-11-09 14:37)