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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -