2012-04-16 00:10:46 +02:00
|
|
|
/*
|
2010-11-20 16:27:17 +01:00
|
|
|
** Copyright (C) 2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
|
|
|
|
**
|
|
|
|
** This program is free software; you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation; either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
2012-04-16 00:10:46 +02:00
|
|
|
**
|
2010-11-20 16:27:17 +01:00
|
|
|
** This program is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
2012-04-16 00:10:46 +02:00
|
|
|
**
|
2010-11-20 16:27:17 +01:00
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with this program; if not, write to the Free Software Foundation,
|
2012-04-16 00:10:46 +02:00
|
|
|
** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
**
|
2010-11-20 16:27:17 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#if HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif /*HAVE_CONFIG_H*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
2010-11-22 23:44:18 +01:00
|
|
|
#include "mu-str.h"
|
2010-11-20 16:27:17 +01:00
|
|
|
|
2010-12-03 19:53:25 +01:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
char*
|
2012-06-11 23:11:14 +02:00
|
|
|
mu_str_normalize (const char *str, gboolean downcase, GStringChunk *strchunk)
|
2010-11-20 16:27:17 +01:00
|
|
|
{
|
2012-06-11 23:11:14 +02:00
|
|
|
char *mystr;
|
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
g_return_val_if_fail (str, NULL);
|
|
|
|
|
2012-06-11 23:11:14 +02:00
|
|
|
if (strchunk)
|
|
|
|
mystr = g_string_chunk_insert (strchunk, str);
|
|
|
|
else
|
|
|
|
mystr = g_strdup (str);
|
|
|
|
|
|
|
|
return mu_str_normalize_in_place_try (mystr, downcase, strchunk);
|
2010-11-20 16:27:17 +01:00
|
|
|
}
|
|
|
|
|
2010-12-03 19:53:25 +01:00
|
|
|
|
2012-04-16 00:10:46 +02:00
|
|
|
/* this implementation should work for _all_ locales. */
|
|
|
|
static char*
|
2012-06-11 23:11:14 +02:00
|
|
|
mu_str_normalize_in_place_generic (char *str, gboolean downcase, GStringChunk *strchunk)
|
2012-04-16 00:10:46 +02:00
|
|
|
{
|
|
|
|
|
2012-06-11 23:11:14 +02:00
|
|
|
char *norm;
|
|
|
|
size_t len;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2012-06-11 23:11:14 +02:00
|
|
|
/* FIXME: add accent-folding etc. */
|
|
|
|
if (!downcase)
|
|
|
|
return str; /* nothing to do */
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2012-06-11 23:11:14 +02:00
|
|
|
len = strlen (str);
|
|
|
|
norm = g_utf8_strdown (str, len);
|
2012-04-16 00:10:46 +02:00
|
|
|
|
|
|
|
|
2012-06-11 23:11:14 +02:00
|
|
|
if (strlen (norm) > len) {
|
|
|
|
/* this case is rare, but does happen */
|
|
|
|
char *copy;
|
|
|
|
if (!strchunk)
|
|
|
|
return norm;
|
|
|
|
copy = g_string_chunk_insert (strchunk, norm);
|
|
|
|
g_free (norm);
|
|
|
|
return copy;
|
2012-04-16 00:10:46 +02:00
|
|
|
}
|
|
|
|
|
2012-06-11 23:11:14 +02:00
|
|
|
memcpy (str, norm, len);
|
2012-04-16 00:10:46 +02:00
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-03 19:53:25 +01:00
|
|
|
/*
|
|
|
|
* this implementation works for accented chars in Unicode Blocks
|
|
|
|
* 'Latin-1 Supplement' and 'Latin Extended-A'. An alternative (slower
|
|
|
|
* but much simpler) implementation would be to use g_utf8_normalize
|
|
|
|
* to decompose characters in the accent part and the character part,
|
|
|
|
* and then get rid of the former. That would be slower than what we
|
|
|
|
* do here, but also more *complete*. It's unclear whether it would
|
|
|
|
* be slower *in practice* => needs checking
|
|
|
|
*/
|
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
/* we can normalize in-place, as the normalized string will never be
|
|
|
|
* longer than the original. even for replacements that are 2 chars
|
|
|
|
* wide (e.g. German ß => ss), the replacement is 2 bytes, like the
|
|
|
|
* original 0xc3 0x9f
|
2012-06-26 21:47:25 +02:00
|
|
|
*
|
|
|
|
* note-to-self: http://www.geertvanderploeg.com/unicode-gen/
|
2010-11-20 16:27:17 +01:00
|
|
|
*/
|
|
|
|
char*
|
2012-06-11 23:11:14 +02:00
|
|
|
mu_str_normalize_in_place_try (char *str, gboolean downcase, GStringChunk *strchunk)
|
2010-11-20 16:27:17 +01:00
|
|
|
{
|
|
|
|
const guchar *cur;
|
|
|
|
int i;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
g_return_val_if_fail (str, NULL);
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
if (*str == '\0')
|
|
|
|
return str;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
for (i = 0, cur = (const guchar*)str; *cur; ++cur) {
|
2010-11-29 20:19:45 +01:00
|
|
|
|
2012-04-16 00:10:46 +02:00
|
|
|
/* special case for plain-old ascii */
|
|
|
|
if ((*cur < 0x80)) {
|
2010-11-29 20:19:45 +01:00
|
|
|
str[i++] = downcase ? tolower (*cur) : *cur;
|
2012-04-16 00:10:46 +02:00
|
|
|
continue;
|
2010-11-20 16:27:17 +01:00
|
|
|
}
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
if (*cur == 0xc3) { /* latin-1 supplement */
|
|
|
|
++cur;
|
|
|
|
switch (*cur) {
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0x80:
|
|
|
|
case 0x81:
|
|
|
|
case 0x82:
|
|
|
|
case 0x83:
|
|
|
|
case 0x84:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x85: str[i++] = downcase ? 'a' : 'A' ; break;
|
2010-11-20 16:27:17 +01:00
|
|
|
|
2012-04-16 00:10:46 +02:00
|
|
|
case 0x86:
|
2010-11-29 20:19:45 +01:00
|
|
|
str[i++] = downcase ? 'a' : 'A' ;
|
|
|
|
str[i++] = 'e';
|
|
|
|
break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x87: str[i++] = downcase ? 'c' : 'C'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0x88:
|
|
|
|
case 0x89:
|
|
|
|
case 0x8a:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x8b:
|
|
|
|
str[i++] = downcase ? 'e' : 'E';
|
|
|
|
break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0x8c:
|
|
|
|
case 0x8d:
|
|
|
|
case 0x8e:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x8f: str[i++] = downcase ? 'i': 'I'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x90: str[i++] = downcase ? 'd' : 'D'; break;
|
|
|
|
case 0x91: str[i++] = downcase ? 'n' : 'N'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0x92:
|
|
|
|
case 0x93:
|
|
|
|
case 0x94:
|
|
|
|
case 0x95:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x96: str[i++] = downcase ? 'o' : 'O'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0x99:
|
|
|
|
case 0x9a:
|
|
|
|
case 0x9b:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x9c: str[i++] = downcase ? 'u' : 'U'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x9d: str[i++] = downcase ? 'y' : 'Y'; break;
|
|
|
|
|
|
|
|
case 0x9e:
|
|
|
|
str[i++] = downcase ? 't' : 'T';
|
|
|
|
str[i++] = 'h';
|
|
|
|
break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0x9f: str[i++] = 's'; str[i++] = 's'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0xa0:
|
|
|
|
case 0xa1:
|
|
|
|
case 0xa2:
|
|
|
|
case 0xa3:
|
|
|
|
case 0xa4:
|
|
|
|
case 0xa5: str[i++] = 'a'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0xa6: str[i++] = 'a'; str[i++] = 'e'; break;
|
|
|
|
case 0xa7: str[i++] = 'c'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0xa8:
|
|
|
|
case 0xa9:
|
|
|
|
case 0xaa:
|
|
|
|
case 0xab: str[i++] = 'e'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0xac:
|
|
|
|
case 0xad:
|
|
|
|
case 0xae:
|
|
|
|
case 0xaf: str[i++] = 'i'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0xb0: str[i++] = 'd'; break;
|
|
|
|
case 0xb1: str[i++] = 'n'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0xb2:
|
|
|
|
case 0xb3:
|
|
|
|
case 0xb4:
|
|
|
|
case 0xb5:
|
|
|
|
case 0xb6: str[i++] = 'o'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0xb9:
|
|
|
|
case 0xba:
|
|
|
|
case 0xbb:
|
|
|
|
case 0xbc: str[i++] = 'u'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0xbd: str[i++] = 'y'; break;
|
|
|
|
case 0xbe: str[i++] = 't'; str[i++] = 'h'; break;
|
|
|
|
case 0xbf: str[i++] = 'y'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
default:
|
|
|
|
str[i++] = *cur;
|
|
|
|
}
|
2010-11-29 20:19:45 +01:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
} else if (*cur == 0xc4) { /* Latin Extended-A (0x04) */
|
|
|
|
++cur;
|
2012-04-16 00:10:46 +02:00
|
|
|
switch (*cur) {
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0x80:
|
|
|
|
case 0x82:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x84: str[i++] = downcase ? 'a' : 'A'; break;
|
2010-11-20 16:27:17 +01:00
|
|
|
|
|
|
|
case 0x86:
|
|
|
|
case 0x88:
|
|
|
|
case 0x8a:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x8c: str[i++] = downcase ? 'c' : 'C'; break;
|
2010-11-20 16:27:17 +01:00
|
|
|
|
|
|
|
case 0x8e:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x90: str[i++] = downcase ? 'd' : 'D'; break;
|
2010-11-20 16:27:17 +01:00
|
|
|
|
|
|
|
case 0x92:
|
|
|
|
case 0x94:
|
|
|
|
case 0x96:
|
|
|
|
case 0x98:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x9a: str[i++] = downcase ? 'e' : 'E'; break;
|
2010-11-20 16:27:17 +01:00
|
|
|
|
|
|
|
case 0x9c:
|
|
|
|
case 0x9e:
|
|
|
|
case 0xa0:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0xa2: str[i++] = downcase ? 'g' : 'G'; break;
|
2010-11-20 16:27:17 +01:00
|
|
|
|
|
|
|
case 0xa4:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0xa6: str[i++] = downcase ? 'h' : 'H'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0xa8:
|
|
|
|
case 0xaa:
|
|
|
|
case 0xac:
|
|
|
|
case 0xae:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0xb0: str[i++] = downcase ? 'i' : 'I'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0xb2:
|
|
|
|
str[i++] = downcase ? 'i' : 'I';
|
|
|
|
str[i++] = downcase ? 'j' : 'J';
|
|
|
|
break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0xb4: str[i++] = downcase ? 'j' : 'J'; break;
|
2010-11-20 16:27:17 +01:00
|
|
|
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0xb6: str[i++] = downcase ? 'k' : 'K'; break;
|
2010-11-20 16:27:17 +01:00
|
|
|
|
|
|
|
case 0xb9:
|
|
|
|
case 0xbb:
|
|
|
|
case 0xbd:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0xbf: str[i++] = downcase ? 'l': 'L'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0x81:
|
|
|
|
case 0x83:
|
|
|
|
case 0x85: str[i++] = 'a'; break;
|
|
|
|
|
|
|
|
case 0x87:
|
|
|
|
case 0x89:
|
|
|
|
case 0x8b:
|
|
|
|
case 0x8d: str[i++] = 'c'; break;
|
|
|
|
|
|
|
|
case 0x8f:
|
|
|
|
case 0x91: str[i++] = 'd'; break;
|
|
|
|
|
|
|
|
case 0x93:
|
|
|
|
case 0x95:
|
|
|
|
case 0x97:
|
|
|
|
case 0x99:
|
|
|
|
case 0x9b: str[i++] = 'e'; break;
|
|
|
|
|
|
|
|
case 0x9d:
|
|
|
|
case 0x9f:
|
|
|
|
case 0xa1:
|
|
|
|
case 0xa: str[i++] = 'g'; break;
|
|
|
|
|
|
|
|
case 0xa5:
|
|
|
|
case 0xa7: str[i++] = 'h'; break;
|
|
|
|
|
|
|
|
case 0xa9:
|
|
|
|
case 0xab:
|
|
|
|
case 0xad:
|
|
|
|
case 0xaf:
|
|
|
|
case 0xb1: str[i++] = 'i'; break;
|
|
|
|
|
|
|
|
case 0xb3: str[i++] = 'i'; str[i++] = 'j'; break;
|
|
|
|
|
|
|
|
case 0xb5: str[i++] = 'j'; break;
|
|
|
|
|
|
|
|
case 0xb7:
|
|
|
|
case 0xb8: str[i++] = 'k'; break;
|
|
|
|
|
|
|
|
case 0xba:
|
|
|
|
case 0xbc:
|
|
|
|
case 0xbe: str[i++] = 'l'; break;
|
|
|
|
|
2010-11-29 20:19:45 +01:00
|
|
|
default: str[i++] = *cur; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
}
|
|
|
|
|
2012-04-16 00:10:46 +02:00
|
|
|
} else if (*cur == 0xc5) { /* Latin Extended-A (0xc5) */
|
2010-11-20 16:27:17 +01:00
|
|
|
++cur;
|
|
|
|
switch (*cur) {
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x81: str[i++] = downcase ? 'l': 'L'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0x83:
|
|
|
|
case 0x85:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x87: str[i++] = downcase ? 'n': 'N'; break;
|
2010-11-20 16:27:17 +01:00
|
|
|
|
|
|
|
case 0x8c:
|
|
|
|
case 0x8e:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x90: str[i++] = downcase ? 'o': 'O'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x92:
|
|
|
|
str[i++] = downcase ? 'o': 'O';
|
|
|
|
str[i++] = 'e';
|
|
|
|
break;
|
2010-11-20 16:27:17 +01:00
|
|
|
|
|
|
|
case 0x94:
|
|
|
|
case 0x96:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0x98: str[i++] = downcase ? 'r': 'R'; break;
|
2010-11-20 16:27:17 +01:00
|
|
|
|
|
|
|
case 0x9a:
|
|
|
|
case 0x9c:
|
|
|
|
case 0x9e:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0xa0: str[i++] = downcase ? 's': 'S'; break;
|
2010-11-20 16:27:17 +01:00
|
|
|
|
|
|
|
case 0xa2:
|
|
|
|
case 0xa4:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0xa6: str[i++] = downcase ? 't': 'T'; break;
|
2010-11-20 16:27:17 +01:00
|
|
|
|
|
|
|
case 0xa8:
|
|
|
|
case 0xaa:
|
|
|
|
case 0xac:
|
|
|
|
case 0xae:
|
2012-04-16 00:10:46 +02:00
|
|
|
case 0xb0:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0xb2: str[i++] = downcase ? 'u': 'U'; break;
|
|
|
|
case 0xb4: str[i++] = downcase ? 'w': 'W'; break;
|
2010-11-20 16:27:17 +01:00
|
|
|
|
|
|
|
case 0xb6:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0xb8: str[i++] = downcase ? 'y': 'Y'; break;
|
2010-11-20 16:27:17 +01:00
|
|
|
|
|
|
|
case 0xb9:
|
2012-04-16 00:10:46 +02:00
|
|
|
case 0xbb:
|
2010-11-29 20:19:45 +01:00
|
|
|
case 0xbd: str[i++] = downcase ? 'z': 'Z'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0x80:
|
|
|
|
case 0x82: str[i++] = 'l'; break;
|
|
|
|
|
|
|
|
case 0x84:
|
|
|
|
case 0x86:
|
|
|
|
case 0x88:
|
|
|
|
case 0x89:
|
|
|
|
case 0x8a:
|
|
|
|
case 0x8b: str[i++] = 'n'; break;
|
|
|
|
|
|
|
|
case 0x8d:
|
|
|
|
case 0x8f:
|
|
|
|
case 0x91: str[i++] = 'o'; break;
|
|
|
|
|
|
|
|
case 0x93: str[i++] = 'o'; str[i++] = 'e'; break;
|
|
|
|
|
|
|
|
case 0x95:
|
|
|
|
case 0x97:
|
|
|
|
case 0x99: str[i++] = 'r'; break;
|
|
|
|
|
|
|
|
case 0x9b:
|
|
|
|
case 0x9d:
|
|
|
|
case 0x9f:
|
|
|
|
case 0xa1: str[i++] = 's'; break;
|
|
|
|
|
|
|
|
case 0xa3:
|
|
|
|
case 0xa5:
|
|
|
|
case 0xa7: str[i++] = 't'; break;
|
|
|
|
|
|
|
|
case 0xa9:
|
|
|
|
case 0xab:
|
|
|
|
case 0xad:
|
|
|
|
case 0xaf:
|
2012-04-16 00:10:46 +02:00
|
|
|
case 0xb1:
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0xb3: str[i++] = 'u'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0xb5: str[i++] = 'w'; break;
|
|
|
|
|
|
|
|
case 0xb7: str[i++] = 'y'; break;
|
|
|
|
|
|
|
|
case 0xba:
|
2012-04-16 00:10:46 +02:00
|
|
|
case 0xbc:
|
2010-11-20 16:27:17 +01:00
|
|
|
case 0xbe: str[i++] = 'z'; break;
|
|
|
|
|
|
|
|
case 0xbf: str[i++] = 's'; break;
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-29 20:19:45 +01:00
|
|
|
default: str[i++] = *cur; break;
|
2010-11-20 16:27:17 +01:00
|
|
|
}
|
2012-04-16 00:10:46 +02:00
|
|
|
} else {
|
|
|
|
/* our fast-path for latin-utf8 does not work -- bummer!
|
|
|
|
* use something more generic (but a bit slower)
|
|
|
|
*/
|
2012-06-11 23:11:14 +02:00
|
|
|
return mu_str_normalize_in_place_generic (str, downcase, strchunk);
|
2010-11-20 16:27:17 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-29 20:19:45 +01:00
|
|
|
str[i] = '\0';
|
2012-04-16 00:10:46 +02:00
|
|
|
|
2010-11-20 16:27:17 +01:00
|
|
|
return str;
|
|
|
|
}
|