summaryrefslogtreecommitdiffstats
path: root/src/include/common/unicode_norm.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:19:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:19:15 +0000
commit6eb9c5a5657d1fe77b55cc261450f3538d35a94d (patch)
tree657d8194422a5daccecfd42d654b8a245ef7b4c8 /src/include/common/unicode_norm.h
parentInitial commit. (diff)
downloadpostgresql-13-6eb9c5a5657d1fe77b55cc261450f3538d35a94d.tar.xz
postgresql-13-6eb9c5a5657d1fe77b55cc261450f3538d35a94d.zip
Adding upstream version 13.4.upstream/13.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/include/common/unicode_norm.h')
-rw-r--r--src/include/common/unicode_norm.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/include/common/unicode_norm.h b/src/include/common/unicode_norm.h
new file mode 100644
index 0000000..731e05b
--- /dev/null
+++ b/src/include/common/unicode_norm.h
@@ -0,0 +1,39 @@
+/*-------------------------------------------------------------------------
+ *
+ * unicode_norm.h
+ * Routines for normalizing Unicode strings
+ *
+ * These definitions are used by both frontend and backend code.
+ *
+ * Copyright (c) 2017-2020, PostgreSQL Global Development Group
+ *
+ * src/include/common/unicode_norm.h
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef UNICODE_NORM_H
+#define UNICODE_NORM_H
+
+#include "mb/pg_wchar.h"
+
+typedef enum
+{
+ UNICODE_NFC = 0,
+ UNICODE_NFD = 1,
+ UNICODE_NFKC = 2,
+ UNICODE_NFKD = 3,
+} UnicodeNormalizationForm;
+
+/* see UAX #15 */
+typedef enum
+{
+ UNICODE_NORM_QC_NO = 0,
+ UNICODE_NORM_QC_YES = 1,
+ UNICODE_NORM_QC_MAYBE = -1,
+} UnicodeNormalizationQC;
+
+extern pg_wchar *unicode_normalize(UnicodeNormalizationForm form, const pg_wchar *input);
+
+extern UnicodeNormalizationQC unicode_is_normalized_quickcheck(UnicodeNormalizationForm form, const pg_wchar *input);
+
+#endif /* UNICODE_NORM_H */