summaryrefslogtreecommitdiffstats
path: root/Lib/json/encoder.py
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2012-09-01 04:27:58 (GMT)
committerPetri Lehtinen <petri@digip.org>2012-09-01 04:29:06 (GMT)
commitf9e1f1128b1d040cabb519ab18f770aa0c456744 (patch)
tree2fba2ebfc23e2ba6ebf744a9527a436da23ecd2d /Lib/json/encoder.py
parent201018718fc55fada8fd159b86bc038c3d297597 (diff)
downloadcpython-f9e1f1128b1d040cabb519ab18f770aa0c456744.zip
cpython-f9e1f1128b1d040cabb519ab18f770aa0c456744.tar.gz
cpython-f9e1f1128b1d040cabb519ab18f770aa0c456744.tar.bz2
#13769: Enhance docs for ensure_ascii semantics in JSON decoding functions
Diffstat (limited to 'Lib/json/encoder.py')
-rw-r--r--Lib/json/encoder.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/json/encoder.py b/Lib/json/encoder.py
index b0d745b..169450d 100644
--- a/Lib/json/encoder.py
+++ b/Lib/json/encoder.py
@@ -107,9 +107,12 @@ class JSONEncoder(object):
encoding of keys that are not str, int, long, float or None. If
skipkeys is True, such items are simply skipped.
- If ensure_ascii is true, the output is guaranteed to be str
- objects with all incoming unicode characters escaped. If
- ensure_ascii is false, the output will be unicode object.
+ If *ensure_ascii* is true (the default), all non-ASCII
+ characters in the output are escaped with \uXXXX sequences,
+ and the results are str instances consisting of ASCII
+ characters only. If ensure_ascii is False, a result may be a
+ unicode instance. This usually happens if the input contains
+ unicode strings or the *encoding* parameter is used.
If check_circular is true, then lists, dicts, and custom encoded
objects will be checked for circular references during encoding to