Skip to content
This repository has been archived by the owner on Mar 11, 2022. It is now read-only.

Commit

Permalink
Add unicode encoding for handling text attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
alfinkel committed Mar 4, 2016
1 parent adfe166 commit b0b522c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/cloudant/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import requests
from requests.exceptions import HTTPError

from ._2to3 import url_quote, url_quote_plus
from ._2to3 import unicode_, url_quote, url_quote_plus
from .errors import CloudantException


Expand Down Expand Up @@ -406,11 +406,11 @@ def get_attachment(

if write_to is not None:
if attachment_type == 'text' or attachment_type == 'json':
write_to.write(resp.text)
write_to.write(unicode_(resp.text))
else:
write_to.write(resp.content)
if attachment_type == 'text':
return resp.text
return unicode_(resp.text)
elif attachment_type == 'json':
return resp.json()

Expand Down

0 comments on commit b0b522c

Please sign in to comment.