It uses pack/unpack pattern "A3" which removes trailing spaces.
I guess that you could also replace the unpack template with 'a3a1a1' since the "a" format won't strip trailing whitespace.