JysonEncodeOptions
Version 1 (Alan Kennedy, 03/17/2009 08:31 pm)
| 1 | 1 | h1. Options for controlling the jyson encoding process. |
|
|---|---|---|---|
| 2 | 1 | ||
| 3 | 1 | 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 | 1 | ||
| 5 | 1 | <pre> |
|
| 6 | 1 | >>> from com.xhaus.jyson import JysonCodec as json |
|
| 7 | 1 | >>> s = u"Al\u00e1in" |
|
| 8 | 1 | >>> json.dumps(s) |
|
| 9 | 1 | u'"Al\xe1in"' |
|
| 10 | 1 | >>> json.dumps(s, emit_ascii=True) |
|
| 11 | 1 | u'"Al\\u00E1in"' |
|
| 12 | 1 | >>> |
|
| 13 | 1 | </pre> |