diff --git a/CHANGELOG.md b/CHANGELOG.md index 5beb3506..af9bd95a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Bug Fixes - Fix `read-line` to prevent data loss when used in conjunction with other I/O functions (such as `read-char`) to read from the same port. Previous versions of `read-line` would use a different internal buffer than our other I/O functions. - Properly handle literal vectors at the top level of compiled code. +- Properly escape C strings in compiled code to avoid trigraphs. ## 0.30.0 - July 2, 2021 diff --git a/scheme/cyclone/cgen.sld b/scheme/cyclone/cgen.sld index 0aff6deb..1ad11928 100644 --- a/scheme/cyclone/cgen.sld +++ b/scheme/cyclone/cgen.sld @@ -69,6 +69,8 @@ (letrec ((next (lambda (head tail) (cond ((null? head) (list->string (reverse tail))) + ((equal? (car head) #\?) ;; Escape ? to avoid trigraphs + (next (cdr head) (cons #\? (cons #\\ tail)))) ((equal? (car head) #\") (next (cdr head) (cons #\" (cons #\\ tail)))) ((equal? (car head) #\\)