2
0

unicode_norm.h 976 B

123456789101112131415161718192021222324252627282930313233343536373839
  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-2022, 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. #include "mb/pg_wchar.h"
  17. typedef enum
  18. {
  19. UNICODE_NFC = 0,
  20. UNICODE_NFD = 1,
  21. UNICODE_NFKC = 2,
  22. UNICODE_NFKD = 3,
  23. } UnicodeNormalizationForm;
  24. /* see UAX #15 */
  25. typedef enum
  26. {
  27. UNICODE_NORM_QC_NO = 0,
  28. UNICODE_NORM_QC_YES = 1,
  29. UNICODE_NORM_QC_MAYBE = -1,
  30. } UnicodeNormalizationQC;
  31. extern pg_wchar *unicode_normalize(UnicodeNormalizationForm form, const pg_wchar *input);
  32. extern UnicodeNormalizationQC unicode_is_normalized_quickcheck(UnicodeNormalizationForm form, const pg_wchar *input);
  33. #endif /* UNICODE_NORM_H */