GNU bug report logs - #56675
UTF16 encoding adds BOM before every single character

Previous Next

Package: guile;

Reported by: Jean Abou Samra <jean <at> abou-samra.fr>

Date: Wed, 20 Jul 2022 21:41:02 UTC

Severity: normal

To reply to this bug, email your comments to 56675 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#56675; Package guile. (Wed, 20 Jul 2022 21:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jean Abou Samra <jean <at> abou-samra.fr>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Wed, 20 Jul 2022 21:41:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean Abou Samra <jean <at> abou-samra.fr>
To: bug-guile <at> gnu.org
Subject: UTF16 encoding adds BOM before every single character
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





This bug report was last modified 2 years and 328 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.