Test and fix writing wide strings.