ruby on rails - String is .blank? but neither empty nor whitespace -
i'm trying use squish method reduce multiple white spaces in string single white spaces. however, have string mutliple spaces not reduced. when check string[space_position].blank?
returns true, neither empty, nor == ' '
.
what cause behavior?
not sure if relevant, string comes mongodb , saved there locomotive cms.
the 3 spaces: [32,160,32]
ascii 160 non breaking space found in html, , apparently not recognized squish
space. try replace before:
string.gsub(160.chr, ' ').squish
Comments
Post a Comment