With this code: (let ((p (open-output-file "x.txt"))) (set-port-encoding! p "UTF16") (display "ABC" p) (close-port p))
the sequence of bytes in the output file x.txt is ['FF', 'FE', '41', '0', 'FF', 'FE', '42', '0', 'FF', 'FE', '43', '0'] As you can see, a BOM is being added before every single character instead of just at the beginning. Originally reported at https://lists.gnu.org/archive/html/guile-user/2022-07/msg00041.html