Project

General

Profile

JysonEncodeOptions » History » Version 1

Alan Kennedy, 2009-03-17 08:31 PM

1 1 Alan Kennedy
h1. Options for controlling the jyson encoding process.
2
3
Jyson has a single option whch controls the output character set of the encoding operation: *emit_ascii*. If this option is *true*, then all characters with a Unicode value above 127 will be encoded as Unicode escapes. If the option is *false*, then a standard java Unicode string will be returned. The default value for the *emit_ascii* option is *False*. The following illustrates the principle
4
5
<pre>
6
>>> from com.xhaus.jyson import JysonCodec as json
7
>>> s = u"Al\u00e1in"
8
>>> json.dumps(s)
9
u'"Al\xe1in"'
10
>>> json.dumps(s, emit_ascii=True)
11
u'"Al\\u00E1in"'
12
>>>
13
</pre>