Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.

Commit ea00e40

Browse files
committed
Merge pull request #157 from jvchn/master
enable Status.AsJsonString() to output non-ascii
2 parents 61bca7f + 278ca17 commit ea00e40

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

twitter/status.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,14 +572,16 @@ def __str__(self):
572572
'''
573573
return self.AsJsonString()
574574

575-
def AsJsonString(self):
575+
def AsJsonString(self, allow_non_ascii=False):
576576
'''A JSON string representation of this twitter.Status instance.
577+
578+
To output non-ascii, set keyword allow_non_ascii=True.
577579
578580
Returns:
579581
A JSON string representation of this twitter.Status instance
580582
'''
581-
return simplejson.dumps(self.AsDict(), sort_keys=True)
582-
583+
return simplejson.dumps(self.AsDict(), sort_keys=True,
584+
ensure_ascii= not allow_non_ascii )
583585
def AsDict(self):
584586
'''A dict representation of this twitter.Status instance.
585587

0 commit comments

Comments
 (0)