MySQL does not behave the way you describe. If you insert into a text column a value containing 5 consecutive spaces, then those 5 consecutive spaces will be stored and retrieved when you query the database. (Trailing whitespace, however, may be trimmed from columns of type varchar.)
Is it possible that you are overlooking the fact that redundant whitespace is not meaningful in HTML?