Skip to content

Commit

Permalink
Fix printing \xFF and \uFFFF
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed Jun 19, 2023
1 parent dc23160 commit 3850828
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ func printable(s string) string {
s2 := ""
for _, r := range s {
if !unicode.IsPrint(r) {
if r < 0xFF {
if r <= 0xFF {
s2 += fmt.Sprintf("\\x%02X", r)
} else if r < 0xFFFF {
} else if r <= 0xFFFF {
s2 += fmt.Sprintf("\\u%04X", r)
} else {
s2 += fmt.Sprintf("\\U%08X", r)
Expand Down

0 comments on commit 3850828

Please sign in to comment.