replace and trim whitespaces bytewise

leave whitespaces in strings