bug#56675: UTF16 encoding adds BOM before every single character

Jean Abou Samra <[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.