mirror of
https://github.com/kiwix/libkiwix.git
synced 2025-06-28 05:49:35 +00:00
+ mutualization of unaccent code
This commit is contained in:
17
src/common/unaccent.cpp
Normal file
17
src/common/unaccent.cpp
Normal 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
7
src/common/unaccent.h
Normal 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);
|
Reference in New Issue
Block a user