org-gcal.el icon indicating copy to clipboard operation
org-gcal.el copied to clipboard

Support unicode

Open larstvei opened this issue 8 years ago • 7 comments

Hi! Thanks for this very cool package!

It seems like non-ASCII characters are ignored when syncing with google calendar.

If I place the following text in the org file I synchronise with google calendar:

* Test: å
  <2017-02-03 Fri 19:00>

Then it is replaced by the following after synchronisation:

* Test: 
  :PROPERTIES:
  :LINK: [[https://www.google.com/calendar/event?eid=djhmMG5zMmZpbnVyYm9haTZuMnNyYnA1Z2sgbGFyc3R2ZWkyQG0][Go to gcal web page]]
  :ID: v8f0ns2finurboai6n2srbp5gk
  :END:

  <2017-02-03 Fri 19:00>

Notice that the å have been removed.

I will try to look into it, but if you could point me in the right direction, that would be great!

larstvei avatar Feb 03 '17 18:02 larstvei

I had the same issue to (with umlauts). Is it possible that the reason for this is that in org-gcal--json-read the encoding in utf-8 is enforced? According to https://stackoverflow.com/questions/8872493/setting-file-encoding-for-org-mode-ical-export (didn't look for the original source) Google expects cp1252

bgschaid avatar Feb 15 '17 09:02 bgschaid

I get lots of encoding errors on my sync'd calendars, where it asks me to choose the encoding to save files as and replace symbols that aren't in it. Is this similar to what's experienced here?

codemac avatar Feb 27 '17 19:02 codemac

My report (russian utf-8): First, it correctly imports the data available in the calendar, however, if I make changes - add синхронизация word to title, for example, the last ones are displayed as A8=E@>=870F8O (in google calendar interface too)

11111000000 avatar Apr 04 '17 04:04 11111000000

So we should patch this part of the code to fix the encoding ?

https://github.com/myuhe/org-gcal.el/blob/master/org-gcal.el#L627

Wouldn't google be happy if we add something like "charset=utf-8" in the Content-Type header ?

https://github.com/myuhe/org-gcal.el/blob/master/org-gcal.el#L626

labe-me avatar Apr 07 '17 15:04 labe-me

Adding charset=utf-8 still removes e.g. æ, ø and å for me. This however, seems to keep them..


(defun org-gcal--post-event (start end smry loc desc &optional id a-token skip-import skip-export)
  (let ((stime (org-gcal--param-date start))
        (etime (org-gcal--param-date end))
        (stime-alt (org-gcal--param-date-alt start))
        (etime-alt (org-gcal--param-date-alt end))
        (a-token (if a-token
                     a-token
                   (org-gcal--get-access-token))))
    (request
     (concat
      (format org-gcal-events-url (car (car org-gcal-file-alist)))
      (when id
        (concat "/" id)))
     :type (if id "PATCH" "POST")
-    :headers '(("Content-Type" . "application/json"))
+    :headers '(("Content-Type" . "application/json;charset=cp1252"))

Still does not work for arbitrary unicode, like e.g. emojis. They sync ok from gcal, but does fetch correctly after posting

torgeir avatar May 14 '17 20:05 torgeir

It seems no UTF-8 encoding has done before posting json data, and this should be the reason of corrupted unicode characters.

See #108

t-suwa avatar Apr 20 '18 06:04 t-suwa

Hi everyone! This repository is obsolete - the actively developed fork is now https://github.com/kidd/org-gcal.el, which is also the "org-gcal.el" on MELPA (see #115). I'm one of the maintainers of https://github.com/kidd/org-gcal.el. I can't directly close issues or PRs on this repo, but please download https://github.com/kidd/org-gcal.el and see if your issue or PR is still applicable. If so, open an issue or PR on https://github.com/kidd/org-gcal.el. In any case, you should close your issue or PR in this repo.

telotortium avatar Jun 11 '20 18:06 telotortium