File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ const (
4545
4646 // Constants for charset validation
4747 asciiMax = 127
48+ asciiMin = 32
4849 invalidByteFormat = "\\ x%02X"
4950 fallbackInvalidByte = "\\ x00"
5051)
@@ -582,12 +583,12 @@ func formatInvalidByteForError(bytesVal []byte) string {
582583
583584 // MySQL shows valid ASCII characters as their actual characters,
584585 // but invalid UTF-8 bytes (> 127) or control characters as hex
585- if b >= 32 && b <= 126 {
586+ if b >= asciiMin && b <= asciiMax {
586587 // Printable ASCII character - show as character
587588 result .WriteByte (b )
588589 } else {
589590 // Invalid UTF-8 byte or control character - show as hex
590- result .WriteString (fmt .Sprintf (" \\ x%02X" , b ))
591+ result .WriteString (fmt .Sprintf (invalidByteFormat , b ))
591592 }
592593 }
593594
You can’t perform that action at this time.
0 commit comments