{"record":{"id":"ca29b26f3fab26f0","repo":"larksuite/cli","slug":"unsupported-charset-q","errorCode":null,"errorMessage":"unsupported charset %q","messagePattern":"unsupported charset %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shortcuts/mail/draft/charset.go","lineNumber":52,"sourceCode":"\nfunc decodeTextCharset(body []byte, label string) ([]byte, error) {\n\tif isUTF8LikeCharset(label) {\n\t\treturn body, nil\n\t}\n\treader, err := htmlcharset.NewReaderLabel(label, bytes.NewReader(body))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn io.ReadAll(reader)\n}\n\nfunc encodeTextCharset(body []byte, label string) ([]byte, error) {\n\tif isUTF8LikeCharset(label) {\n\t\treturn body, nil\n\t}\n\tenc, _ := htmlcharset.Lookup(label)\n\tif enc == nil {\n\t\treturn nil, fmt.Errorf(\"unsupported charset %q\", label) //nolint:forbidigo // intermediate draft charset error; mail command layer wraps into typed ValidationError.\n\t}\n\tvar buf bytes.Buffer\n\twriter := transform.NewWriter(&buf, enc.NewEncoder())\n\tif _, err := writer.Write(body); err != nil {\n\t\t_ = writer.Close()\n\t\treturn nil, err\n\t}\n\tif err := writer.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}\n","sourceCodeStart":34,"sourceCodeEnd":65,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/shortcuts/mail/draft/charset.go#L34-L65","documentation":"encodeTextCharset: the draft's charset label is not UTF-8-like and htmlcharset.Lookup has no matching encoder, so the outgoing MIME part cannot be encoded; an intermediate error the mail command layer wraps into a typed ValidationError.","triggerScenarios":"Thrown at shortcuts/mail/draft/charset.go:52 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use UTF-8 or another alias recognized by htmlcharset (e.g. gb18030, iso-8859-1)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}