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

Commit d5e02a7

Browse files
committed
enable AsJsonString to output unicode
1 parent 588b64b commit d5e02a7

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
@@ -573,14 +573,16 @@ def __str__(self):
573573
'''
574574
return self.AsJsonString()
575575

576-
def AsJsonString(self):
576+
def AsJsonString(self, allow_non_ascii=False):
577577
'''A JSON string representation of this twitter.Status instance.
578+
579+
For unicode encodings, use keyword allow_non_ascii=True.
578580
579581
Returns:
580582
A JSON string representation of this twitter.Status instance
581583
'''
582-
return simplejson.dumps(self.AsDict(), sort_keys=True)
583-
584+
return simplejson.dumps(self.AsDict(), sort_keys=True,
585+
ensure_ascii= not allow_non_ascii )
584586
def AsDict(self):
585587
'''A dict representation of this twitter.Status instance.
586588

0 commit comments

Comments
 (0)