kjkjava / garmin-connect-export

Download a copy of your Garmin Connect data, including stats and GPX tracks.
MIT License
314 stars 134 forks source link

UnicodeEncodeError for ø #38

Open dedwardn opened 6 years ago

dedwardn commented 6 years ago

When downloading activities, the script crashes on activities with "ø" in the name. Error message:

File`"gcexport.py", line 186, in print a['activity']['activityName']['value'] File "C:\Anaconda2\lib\encodings\cp437.py", line 12, in encode return codecs.charmap_encode(input,errors,encoding_map) UnicodeEncodeError: 'charmap' codec can't encode character u'\xf8' in position 1: character maps to \

Tracked it to the json_results = json.loads(result) on line 169 (or in that area if I have changed the script slightly). Basically writing or printing the result variable shows the ø properly in files or on screen, but the "json_results"-dict shows a unicode stringfor the acitivityName as this

{u'value': u'H\xf8vik Cycling'}

Tested with print a['activity']['activityName']['value'].encode('utf-8') (also other encodings without luck) but it produces a weird character.

Anyone know how to fix it?

moderation commented 6 years ago

@dedwardn this repository is no longer maintained. Could you test with this fork that is more up to date?