+ imp version

This commit is contained in:
kelson42 2009-11-14 16:07:01 +00:00
parent 482893ae39
commit 8346cc7a23
1 changed files with 6 additions and 3 deletions

View File

@ -3,15 +3,18 @@
using namespace std; using namespace std;
/* Remove accent */ /* Remove accent */
std::string removeAccents(const char *text) { std::string removeAccents(const char *text = NULL) {
char* out = 0; char* out = 0;
size_t out_length = 0; size_t out_length = 0;
std::string textWithoutAccent = text;
if (!unac_string("UTF8", text, strlen(text), &out, &out_length)) { if (!unac_string("UTF8", text, strlen(text), &out, &out_length)) {
std::string textWithoutAccent = text;
textWithoutAccent = string(out, out_length); textWithoutAccent = string(out, out_length);
free(out); free(out);
return textWithoutAccent;
} if (text != NULL) {
return string(text);
} }
return textWithoutAccent; return "";
} }