Subject: UTF16 encoding adds BOM before every single character

From: Jean Abou Samra <[email-masked]>
Date: Wed, 20 Jul 2022 23:39:57 +0200

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