Change your litWidth
parameter for lzw.NewReader
and lzw.NewWriter
from 2 to 8.
I don't know much about LZW, but it looks like the litWidth
determines how many bits from each incoming byte are considered significant. So, a value of 2 means that all input bytes must be 0x00 - 0x03.
See http://play.golang.org/p/svjeVFntuE for a minimal example of an LZW round-trip. A litWidth
of 7 works (but is presumably not safe for UTF-8 text), anything less than 7 fails.