Skip to content

UnicodeEncodeError for ø #38

@dedwardn

Description

@dedwardn

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 <undefined>

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?

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