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`).
This commit is contained in:
Daniel - 2021-11-06 17:49:49 +01:00
parent a8cfeaf69f
commit e15be73bc1
No known key found for this signature in database
GPG Key ID: 1C7071A75BB72D64
1 changed files with 2 additions and 1 deletions

View File

@ -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)