diff options
Diffstat (limited to 'src/namestore/namestore_common.c')
-rw-r--r-- | src/namestore/namestore_common.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/namestore/namestore_common.c b/src/namestore/namestore_common.c index 47029b73b..403374809 100644 --- a/src/namestore/namestore_common.c +++ b/src/namestore/namestore_common.c | |||
@@ -71,6 +71,25 @@ struct NetworkRecord | |||
71 | 71 | ||
72 | GNUNET_NETWORK_STRUCT_END | 72 | GNUNET_NETWORK_STRUCT_END |
73 | 73 | ||
74 | /** | ||
75 | * Convert a string from to local codeset to UTF-8 lowercase | ||
76 | * @param src source string | ||
77 | * @return converted result | ||
78 | */ | ||
79 | char * | ||
80 | GNUNET_NAMESTORE_normalize_string (const char *src) | ||
81 | { | ||
82 | char *utf_8_str; | ||
83 | |||
84 | GNUNET_assert (NULL != src); | ||
85 | /* Convert to UTF8 */ | ||
86 | utf_8_str = GNUNET_STRINGS_to_utf8 (src, strlen (src), nl_langinfo (CODESET)); | ||
87 | GNUNET_assert (NULL != utf_8_str); | ||
88 | /* normalize */ | ||
89 | GNUNET_STRINGS_utf8_tolower(utf_8_str, &utf_8_str); | ||
90 | return utf_8_str; | ||
91 | } | ||
92 | |||
74 | 93 | ||
75 | /** | 94 | /** |
76 | * Convert a short hash to a string (for printing debug messages). | 95 | * Convert a short hash to a string (for printing debug messages). |