From e15be73bc12c07558fa1f573fd0632d58b67056e Mon Sep 17 00:00:00 2001 From: Daniel Borchmann Date: Sat, 6 Nov 2021 17:49:49 +0100 Subject: [PATCH] Fix insertion of text from hex numbers Using `insert` directly makes use of character conversion and may scramble the byte when inserting into the buffer (indeed, `insert` does not seem to insert the byte, but the characters whose code-points is given in the string; same for `insert-char`). --- site-lisp/db-utils.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/site-lisp/db-utils.el b/site-lisp/db-utils.el index c206c4e..1c1672b 100644 --- a/site-lisp/db-utils.el +++ b/site-lisp/db-utils.el @@ -181,7 +181,8 @@ the result in the minibuffer." (if (use-region-p) (progn (delete-region (region-beginning) (region-end)) - (insert result)) + (dolist (char (string-to-list result)) + (insert-byte char 1))) (message result)))) (defun db/text-to-hex (text-string)