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 (
45
45
46
46
// Constants for charset validation
47
47
asciiMax = 127
48
+ asciiMin = 32
48
49
invalidByteFormat = "\\ x%02X"
49
50
fallbackInvalidByte = "\\ x00"
50
51
)
@@ -582,12 +583,12 @@ func formatInvalidByteForError(bytesVal []byte) string {
582
583
583
584
// MySQL shows valid ASCII characters as their actual characters,
584
585
// but invalid UTF-8 bytes (> 127) or control characters as hex
585
- if b >= 32 && b <= 126 {
586
+ if b >= asciiMin && b <= asciiMax {
586
587
// Printable ASCII character - show as character
587
588
result .WriteByte (b )
588
589
} else {
589
590
// 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 ))
591
592
}
592
593
}
593
594
You can’t perform that action at this time.
0 commit comments