Skip to content

base64 encoding for attachments with Python 3 #47

@vincentborghi

Description

@vincentborghi

The example given in the documentation:
att_content = base64.b64encode(att_file.read())
does not work, because the content string in the generated XML has a leading literal "b" and is enclosed with quotes (b'XXXXX' instead of just XXXXX). As a result, the contents is stored in OTRS but unreadable due to those unwanted characters.

As a workaround, I was obliged to do:
att_content = base64.b64encode(att_file.read()).decode('utf-8')

But the root cause of this is probably a bug in the way "unicode" function is defined in client.py when using python 3.

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