Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTF-8 results #69

Open
johanwk opened this issue Oct 28, 2021 · 1 comment
Open

UTF-8 results #69

johanwk opened this issue Oct 28, 2021 · 1 comment

Comments

@johanwk
Copy link

johanwk commented Oct 28, 2021

I'm having trouble with utf-8 characters in results from sparql-mode. Here's a query that includes the string "cm²" in the result, running e.g. in eshell:

curl "https://endpoint.dexpi.org/information_model/query?query=describe%20<http://sandbox.dexpi.org/informationmodel/ScaleCentimetreSquared>"

Executing the describe from a sparql-mode buffer, I see this -- uninterpretable characters:

"cm\302\262"

I have utf-8 as default character set. Emacs 27.2 on Windows, sparql-mode 4.0.2.

@johanwk
Copy link
Author

johanwk commented Oct 28, 2021

Here's a small change to sparql-handle-results that seems to fix the issue. I've used (car default-process-coding-system) to hopefully obtain the utf-8 choice in a reasonable way.

(defun sparql-handle-results (status &optional output-buffer)
  "Handles the result that comes back from url-retrieve for a
SPARQL query."
  (when (zerop (buffer-size))
    (setq mode-name "SPARQL[error]")
    (error "URL '%s' is not accessible"
           (url-recreate-url url-current-object)))
  (let ((results-buffer (current-buffer))
        (response (url-http-parse-response)))
    (with-current-buffer output-buffer
      (let ((buffer-read-only nil))
        (if (and (<= 200 response) (<= response 299))
; here: 
            (progn (url-insert results-buffer)
                   (decode-coding-region (point-min) (point-max) (car default-process-coding-system)))
;
          (insert-buffer-substring results-buffer))
        (setq mode-name "SPARQL[finished]")))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant