History

unicode: implement higher level API for string handling

This patch integrates the utf8n patches with some higher level API to perform UTF-8 string comparison, normalization and casefolding operations. Implemented is a variation of NFD, and casefold is performed by doing full casefold on top of NFD. These algorithms are based on the core implemented by Olaf Weber from SGI.

Gabriel Krisman Bertazi committed 7 years ago

Commit 9d536901 parent a8384c65 files · +227 −1Browse files

Showing the changes to include/linux (1 of 5 files). Show all

Unified · Split

include/linux/unicode.h+30−0
@@ -0,0 +1,30 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_UNICODE_H
3#define _LINUX_UNICODE_H
4
5#include <linux/init.h>
6#include <linux/dcache.h>
7
8struct unicode_map {
9 const char *charset;
10 int version;
11};
12
13int utf8_validate(const struct unicode_map *um, const struct qstr *str);
14
15int utf8_strncmp(const struct unicode_map *um,
16 const struct qstr *s1, const struct qstr *s2);
17
18int utf8_strncasecmp(const struct unicode_map *um,
19 const struct qstr *s1, const struct qstr *s2);
20
21int utf8_normalize(const struct unicode_map *um, const struct qstr *str,
22 unsigned char *dest, size_t dlen);
23
24int utf8_casefold(const struct unicode_map *um, const struct qstr *str,
25 unsigned char *dest, size_t dlen);
26
27struct unicode_map *utf8_load(const char *version);
28void utf8_unload(struct unicode_map *um);
29
30#endif /* _LINUX_UNICODE_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t