fix charset parsing