Strips extra white space at end of both encoding and decoding processes