ical2csv icon indicating copy to clipboard operation
ical2csv copied to clipboard

May this script do not support Chinese and other not-English language?

Open ruleroller opened this issue 4 years ago • 4 comments

('Extracting events from file:', 'rili.ics', '\n') Traceback (most recent call last): File "ical2csv.py", line 87, in csv_write(filename) File "ical2csv.py", line 69, in csv_write wr.writerow(values) UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)

ruleroller avatar Sep 12 '20 13:09 ruleroller

I know it works with mostly latin-based languages like mine (Danish), but I don't know if it's set up to handle Chinese, Japanese and the like. Also, there might be some fixes I have implemented in ical2txt.py that is not in ical2csv.py yet. I plan to have a look at that one soon.

martinm76 avatar Apr 26 '21 20:04 martinm76

Can you upload a sample ics file somewhere that has this problem? It is working for Danish and English for sure. If UTF-16 is needed, then that is not currently supported.

martinm76 avatar May 02 '21 16:05 martinm76

@martinm76 Sorry, I don't have the env (my Mac is broken) to test right now, but I made a test ics file with calendar items in Chinese, you can download it and do some test. Hope it will help.

ruleroller avatar May 02 '21 16:05 ruleroller

Okay, those two examples work for me at least, with my current branch Note: I have used Europe/Copenhagen as timezone. CSV:

"Summary","UID","Description","Location","Start` Time","End Time","URL"
`"测试1`  test1","[email protected]","测试内容1 content1","","2021-05-04 20:30:00+02:00","2021-05-04 20:45:00+02:00",""
"测试2 test2","[email protected]","内容2 content2","","2021-05-05 22:00:00+02:00","2021-05-05 22:15:00+02:00",""

TXT:

Worklog, 2021-05-04
===================
20:30 - 20:45 (00:15) 测试1  test1
测试内容1 content1


Time Total: 00:15

Worklog, 2021-05-05
===================
22:00 - 22:15 (00:15) 测试2 test2
内容2 content2


Time Total: 00:15

Overridden for your timezone from the file (not sure why that is not adopted, but at least it gives us the option to use our own):

 root@MMO-Monitoring - /opt/git/ical2csv -> sortedevents > TZ="Asia/Shanghai" ./ical2txt.py /tmp/fortest.ics
Opening ics file

Extracting events from file: /tmp/fortest.ics 

Sorting events

Processing events : ..

Wrote 2 events to  /tmp/fortest.txt  and skipped  0  events

 root@MMO-Monitoring - /opt/git/ical2csv -> sortedevents > cat /tmp/fortest.txt

Worklog, 2021-05-05
===================
02:30 - 02:45 (00:15) 测试1  test1
测试内容1 content1


Time Total: 00:15

Worklog, 2021-05-06
===================
04:00 - 04:15 (00:15) 测试2 test2
内容2 content2


Time Total: 00:15

martinm76 avatar May 02 '21 19:05 martinm76