Simple string encoder and decoder