emacs-31 e47bd3070aa: Eglot: decode unhexed file URI paths as UTF-8 (bug#79897)
João Távora <[email protected]>
| Newsgroups | gmane.emacs.diffs |
|---|---|
| Message-ID | <[email protected]> |
branch: emacs-31 commit e47bd3070aa39edb5eb654529f899b494cc6307e Author: duli <[email protected]> Commit: João Távora <[email protected]> Eglot: decode unhexed file URI paths as UTF-8 (bug#79897) 'url-unhex-string' only decodes %XX sequences and returns a unibyte string; it does not interpret the resulting octets as UTF-8. Its docstring says that the resulting string generally requires decoding with an appropriate coding system. LSP messages are UTF-8, and document URIs are transferred as URI strings. When recovering the file path from the URI, decode the unhexed octets as UTF-8 instead of using them directly as an Emacs string. This should fix bug#79897. Copyright-paperwork-exempt: yes * lisp/progmodes/eglot.el (eglot-uri-to-path): Decode the result of 'url-unhex-string' with 'utf-8-unix'. --- lisp/progmodes/eglot.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 457391572a0..2afb2b40094 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1264,7 +1264,8 @@ object." ;; `file-name-handler-alist' should know how to handle them ;; (bug#58790). (if (string= "file" (url-type url)) - (let* ((unhexed (url-unhex-string (url-filename url))) + (let* ((unhexed (decode-coding-string + (url-unhex-string (url-filename url)) 'utf-8-unix)) ;; Remove the leading "/" for local MS Windows-style paths. (norm (if (and (not remote-prefix) (eq system-type 'windows-nt)