1 /*------------------------------------------------------------------------- 2 * 3 * unicode_norm.h 4 * Routines for normalizing Unicode strings 5 * 6 * These definitions are used by both frontend and backend code. 7 * 8 * Copyright (c) 2017-2020, PostgreSQL Global Development Group 9 * 10 * src/include/common/unicode_norm.h 11 * 12 *------------------------------------------------------------------------- 13 */ 14 #ifndef UNICODE_NORM_H 15 #define UNICODE_NORM_H 16 17 #include "mb/pg_wchar.h" 18 19 typedef enum 20 { 21 UNICODE_NFC = 0, 22 UNICODE_NFD = 1, 23 UNICODE_NFKC = 2, 24 UNICODE_NFKD = 3, 25 } UnicodeNormalizationForm; 26 27 /* see UAX #15 */ 28 typedef enum 29 { 30 UNICODE_NORM_QC_NO = 0, 31 UNICODE_NORM_QC_YES = 1, 32 UNICODE_NORM_QC_MAYBE = -1, 33 } UnicodeNormalizationQC; 34 35 extern pg_wchar *unicode_normalize(UnicodeNormalizationForm form, const pg_wchar *input); 36 37 extern UnicodeNormalizationQC unicode_is_normalized_quickcheck(UnicodeNormalizationForm form, const pg_wchar *input); 38 39 #endif /* UNICODE_NORM_H */ 40