summaryrefslogtreecommitdiff
path: root/src/include/mb
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2007-09-18 17:41:17 +0000
committerAndrew Dunstan <andrew@dunslane.net>2007-09-18 17:41:17 +0000
commit55613bf9cd7d6071e43e68ac14bc0243a1027507 (patch)
tree9b151f94d94e7dc3aa5988c03867d3f6f6b562ba /src/include/mb
parent8544110042ddf8be29e177e37f53516686a06da2 (diff)
downloadpostgresql-55613bf9cd7d6071e43e68ac14bc0243a1027507.tar.gz
Close previously open holes for invalidly encoded data to enter the
database via builtin functions, as recently discussed on -hackers. chr() now returns a character in the database encoding. For UTF8 encoded databases the argument is treated as a Unicode code point. For other multi-byte encodings the argument must designate a strict ascii character, or an error is raised, as is also the case if the argument is 0. ascii() is adjusted so that it remains the inverse of chr(). The two argument form of convert() is gone, and the three argument form now takes a bytea first argument and returns a bytea. To cover this loss three new functions are introduced: . convert_from(bytea, name) returns text - converts the first argument from the named encoding to the database encoding . convert_to(text, name) returns bytea - converts the first argument from the database encoding to the named encoding . length(bytea, name) returns int - gives the length of the first argument in characters in the named encoding
Diffstat (limited to 'src/include/mb')
-rw-r--r--src/include/mb/pg_wchar.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/include/mb/pg_wchar.h b/src/include/mb/pg_wchar.h
index 2cb0656cb9..19b5fe1e3a 100644
--- a/src/include/mb/pg_wchar.h
+++ b/src/include/mb/pg_wchar.h
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/include/mb/pg_wchar.h,v 1.72 2007/04/15 10:56:30 ishii Exp $ */
+/* $PostgreSQL: pgsql/src/include/mb/pg_wchar.h,v 1.73 2007/09/18 17:41:17 adunstan Exp $ */
#ifndef PG_WCHAR_H
#define PG_WCHAR_H
@@ -372,6 +372,8 @@ extern void UtfToLocal(const unsigned char *utf, unsigned char *iso,
extern bool pg_verifymbstr(const char *mbstr, int len, bool noError);
extern bool pg_verify_mbstr(int encoding, const char *mbstr, int len,
bool noError);
+extern int pg_verify_mbstr_len(int encoding, const char *mbstr, int len,
+ bool noError);
extern void report_invalid_encoding(int encoding, const char *mbstr, int len);
extern void report_untranslatable_char(int src_encoding, int dest_encoding,