]> git.eshelyaron.com Git - emacs.git/commitdiff
Mention byte order marks in string-limit doc string
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 5 Jul 2022 11:07:56 +0000 (13:07 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 5 Jul 2022 16:27:42 +0000 (18:27 +0200)
* lisp/emacs-lisp/subr-x.el (string-limit): Mention byte order
marks (bug#48324).

lisp/emacs-lisp/subr-x.el

index 56e8c2aa8624d930ae10ecb47cc4426f54ad414b..39697a8e725af9760a5aee0cabc0d042c785b6aa 100644 (file)
@@ -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