~ chicken-core (master) bb961b5d889f88dc5910a23e67025eb2107036c7
commit bb961b5d889f88dc5910a23e67025eb2107036c7
Author: felix <felix@call-with-current-continuation.org>
AuthorDate: Mon Oct 5 17:07:26 2026 +0200
Commit: felix <felix@call-with-current-continuation.org>
CommitDate: Mon Oct 5 17:07:26 2026 +0200
avoid double-encoding in write-char when using other than utf-8 encoding
diff --git a/library.scm b/library.scm
index 449d957d..3588715c 100644
--- a/library.scm
+++ b/library.scm
@@ -4329,7 +4329,7 @@ EOF
(if (eq? enc 'utf-8) ;; fast path
(##core#inline "C_display_char" p c)
(let* ((bv (##sys#make-bytevector 4))
- (n (##sys#encode-char c bv enc)))
+ (n (##core#inline "C_utf_insert" bv 0 c)))
((##sys#slot (##sys#slot p 2) 3) p bv 0 n))))) ; write-bytevector
(lambda (p bv from to) ; write-bytevector
(##sys#encode-buffer
Trap