+ mutualization of unaccent code

This commit is contained in:
kelson42
2009-11-14 15:54:46 +00:00
parent 61bbd9f12f
commit 482893ae39
2 changed files with 24 additions and 0 deletions

17
src/common/unaccent.cpp Normal file
View File

@ -0,0 +1,17 @@
#include "unaccent.h"
using namespace std;
/* Remove accent */
std::string removeAccents(const char *text) {
char* out = 0;
size_t out_length = 0;
std::string textWithoutAccent = text;
if (!unac_string("UTF8", text, strlen(text), &out, &out_length)) {
textWithoutAccent = string(out, out_length);
free(out);
}
return textWithoutAccent;
}

7
src/common/unaccent.h Normal file
View File

@ -0,0 +1,7 @@
#include <stdlib.h>
#include <string>
#include <stdio.h>
#include <unac.h>
#include <string.h>
std::string removeAccents(const char *text);