Skip to content

Ensure UTF-8 encoding #30

@Frozenlock

Description

@Frozenlock

On a Windows machine, utf-8 strings passed to raven/capture will not be properly encoded when sent to Sentry.

As far as I can tell, this is because something in the http stack is using the default file encoding.
Temporary workaround:
Launch the JVM with -Dfile.encoding=utf-8

Potential solution:
Explicitly encode the body into utf-8 bytes.

(defn send-packet [{:keys [ts uri project-id key secret] :as packet-info}]
  (let [url (make-sentry-url uri project-id)
        header (make-sentry-header ts key secret)
        body (dissoc packet-info :ts :uri :project-id :key :secret)]
    (http/post url
               {:throw-exceptions false
                :headers {"X-Sentry-Auth" header
                          "User-Agent" sentry-client}
                :body (util/utf8-bytes (json/generate-string body))}))) ; <------

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions