From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org> |
Subject: | adjust chr()/ascii() to prevent invalidly encoded data |
Date: | 2007-09-14 15:55:58 |
Message-ID: | 46EAAF0E.5090501@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
The attached patch is intended to ensure that chr() does not produce
invalidly encoded data, as recently discussed on -hackers. For UTF8, we
treat its argument as a Unicode code point; for all other multi-byte
encodings, we raise an error on any argument greater than 127. For all
encodings we raise an error if the argument is 0 (we don't allow null
bytes in text data). The ascii() function is adjusted so that it remains
the inverse of chr() - i.e. for UTF8 it returns the Unicode code point,
and it raises an error for any other multi-byte encoding if the
aregument is outside the ASCII range. I have tested thius inverse
property across the entire Unicode code point range, 0x01 .. 0x1ffff.
TODO: alter docs to reflect changes.
cheers
andrew
Attachment | Content-Type | Size |
---|---|---|
codfix2.patch | text/x-patch | 5.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2007-09-14 15:58:05 | Re: GSS warnings |
Previous Message | Bruce Momjian | 2007-09-14 14:54:26 | Re: Linkage for escape strings |