Skip to content

Commit 2aa5890

Browse files
authored
Convert unicode escapse to lowercase (#425)
This aligns with the behaviour exhibited by Ruma & Synapse's canonicaljson
1 parent 2beadf1 commit 2aa5890

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

json.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ func compactUnicodeEscape(input, output []byte, index int) ([]byte, int) {
309309
}
310310
const (
311311
ESCAPES = "uuuuuuuubtnufruuuuuuuuuuuuuuuuuu"
312-
HEX = "0123456789ABCDEF"
312+
HEX = "0123456789abcdef"
313313
)
314314
// If there aren't enough bytes to decode the hex escape then return.
315315
if len(input)-index < 4 {

json_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ func TestCompactJSON(t *testing.T) {
9292
testCompactJSON(t, input, want)
9393

9494
input = `["\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F"]`
95-
want = `["\b\t\n\u000B\f\r\u000E\u000F"]`
95+
want = `["\b\t\n\u000b\f\r\u000e\u000f"]`
9696
testCompactJSON(t, input, want)
9797

9898
input = `["\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017"]`
9999
want = input
100100
testCompactJSON(t, input, want)
101101

102102
input = `["\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F"]`
103-
want = input
103+
want = `["\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f"]`
104104
testCompactJSON(t, input, want)
105105

106106
testCompactJSON(t, `["\u0061\u005C\u0042\u0022"]`, `["a\\B\""]`)

0 commit comments

Comments
 (0)