From d07bacd54a9f7cea065cb912144a25fc9a108c47 Mon Sep 17 00:00:00 2001
From: Tatsuo Ishii <ishii@postgresql.org>
Date: Mon, 15 Oct 2001 01:19:15 +0000
Subject: [PATCH] Add UTF-8 char >= 0x10000 check

---
 src/backend/utils/mb/wchar.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/utils/mb/wchar.c b/src/backend/utils/mb/wchar.c
index e819d5ffeae..0c51da5ab71 100644
--- a/src/backend/utils/mb/wchar.c
+++ b/src/backend/utils/mb/wchar.c
@@ -1,7 +1,7 @@
 /*
  * conversion functions between pg_wchar and multi-byte streams.
  * Tatsuo Ishii
- * $Id: wchar.c,v 1.23 2001/10/11 14:20:35 ishii Exp $
+ * $Id: wchar.c,v 1.24 2001/10/15 01:19:15 ishii Exp $
  *
  * WIN1250 client encoding updated by Pavel Behal
  *
@@ -537,11 +537,19 @@ pg_verifymbstr(const unsigned char *mbstr, int len)
 	int	slen = 0;
 
 	/* we do not check single byte encodings */
-	if (pg_encoding_max_length(GetDatabaseEncoding()) <= 1)
+	if (pg_database_encoding_max_length() <= 1)
 	    return NULL;
 
 	while (len > 0 && *mbstr)
 	{
+		/* special UTF-8 check */
+		if (GetDatabaseEncoding() == PG_UTF8 &&
+		    (*mbstr & 0xf8) == 0xf0)
+		{
+		    snprintf(buf, sizeof(buf), "Unicode >= 0x10000 is not supoorted");
+		    return(buf);
+		}
+		    
 		l = pg_mblen(mbstr);
 
 		/* multi-byte letter? */
-- 
GitLab