select: Check if CSV is valid utf8 (#10991)

Check if first block of data is valid utf8.

Fixes #10970
This commit is contained in:
Klaus Post
2020-12-01 09:09:06 -08:00
committed by GitHub
parent 7cbca43eb1
commit 02aecb2fc1
2 changed files with 25 additions and 3 deletions

View File

@@ -16,6 +16,8 @@
package csv
import "errors"
type s3Error struct {
code string
message string
@@ -51,3 +53,12 @@ func errCSVParsingError(err error) *s3Error {
cause: err,
}
}
func errInvalidTextEncodingError() *s3Error {
return &s3Error{
code: "InvalidTextEncoding",
message: "UTF-8 encoding is required.",
statusCode: 400,
cause: errors.New("invalid utf8 encoding"),
}
}