mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
guile-json: upgrade to 4-byte unicode chars.
This commit is contained in:
committed by
Geert Janssens
parent
f2337406a3
commit
02cfd017e9
@@ -72,6 +72,14 @@
|
||||
(u8v-2->unicode bv)
|
||||
(u8v-3->unicode bv))))
|
||||
(unicode->string unicode)))
|
||||
;; A 4 byte UTF-8 needs to output as \uHHHH\uHHHH
|
||||
((eq? len 4)
|
||||
(let ((bv4 (string->utf16 (string c))))
|
||||
(string-append
|
||||
(unicode->string (+ (ash (bytevector-u8-ref bv4 0) 8)
|
||||
(bytevector-u8-ref bv4 1)))
|
||||
(unicode->string (+ (ash (bytevector-u8-ref bv4 2) 8)
|
||||
(bytevector-u8-ref bv4 3))))))
|
||||
;; Anything else should wrong, hopefully.
|
||||
(else (throw 'json-invalid)))))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user