emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8681bf1e85 1/3: Mention byte order marks in string-limit doc stri


From: Lars Ingebrigtsen
Subject: master 8681bf1e85 1/3: Mention byte order marks in string-limit doc string
Date: Tue, 5 Jul 2022 12:27:49 -0400 (EDT)

branch: master
commit 8681bf1e851dd4abda066ddab5199768f310db8a
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Mention byte order marks in string-limit doc string
    
    * lisp/emacs-lisp/subr-x.el (string-limit): Mention byte order
    marks (bug#48324).
---
 lisp/emacs-lisp/subr-x.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 56e8c2aa86..39697a8e72 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -169,7 +169,12 @@ limiting, and LENGTH is interpreted as the number of bytes 
to
 limit the string to.  The result will be a unibyte string that is
 shorter than LENGTH, but will not contain \"partial\"
 characters (or glyphs), even if CODING-SYSTEM encodes characters
-with several bytes per character.
+with several bytes per character.  If the coding system specifies
+things like byte order marks (aka \"BOM\") or language tags, they
+will normally be part of the calculation.  This is the case, for
+instance, with `utf-16'.  If this isn't desired, use a coding
+system that doesn't specify a BOM, like `utf-16le' or
+`utf-16be'.
 
 When shortening strings for display purposes,
 `truncate-string-to-width' is almost always a better alternative



reply via email to

[Prev in Thread] Current Thread [Next in Thread]