diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2013-06-12 13:35:24 -0400 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2013-06-12 13:35:24 -0400 |
commit | 78ed8e03c67d7333708f5c1873ec1d239ae2d7e0 (patch) | |
tree | 3e55afe4518926147b449171566cba0ebccdb358 /doc/src | |
parent | c1d729b419ee876c32ddf4ac3a85fa89a6b4a89b (diff) | |
download | postgresql-78ed8e03c67d7333708f5c1873ec1d239ae2d7e0.tar.gz postgresql-78ed8e03c67d7333708f5c1873ec1d239ae2d7e0.zip |
Fix unescaping of JSON Unicode escapes, especially for non-UTF8.
Per discussion on -hackers. We treat Unicode escapes when unescaping
them similarly to the way we treat them in PostgreSQL string literals.
Escapes in the ASCII range are always accepted, no matter what the
database encoding. Escapes for higher code points are only processed in
UTF8 databases, and attempts to process them in other databases will
result in an error. \u0000 is never unescaped, since it would result in
an impermissible null byte.
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/func.sgml | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 3adb36579ea..4c5af4b83c8 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -10161,6 +10161,17 @@ table2-mapping <note> <para> + Many of these functions and operators will convert Unicode escapes + in the JSON text to the appropriate UTF8 character when the database encoding is UTF8. In + other encodings the escape sequence must be for an ASCII character, and any other code point + in a Unicode escape sequence will result in an error. + In general, it is best to avoid mixing Unicode escapes in JSON with a non-UTF8 database + encoding, if possible. + </para> + </note> + + <note> + <para> The <xref linkend="hstore"> extension has a cast from <type>hstore</type> to <type>json</type>, so that converted <type>hstore</type> values are represented as JSON objects, not as string values. |