mirror of https://github.com/kiwix/libkiwix.git
+ small imp.
This commit is contained in:
parent
8346cc7a23
commit
c19ad61051
|
@ -4,7 +4,7 @@ using namespace std;
|
||||||
|
|
||||||
/* Remove accent */
|
/* Remove accent */
|
||||||
std::string removeAccents(const char *text = NULL) {
|
std::string removeAccents(const char *text = NULL) {
|
||||||
char* out = 0;
|
char* out = NULL;
|
||||||
size_t out_length = 0;
|
size_t out_length = 0;
|
||||||
|
|
||||||
if (!unac_string("UTF8", text, strlen(text), &out, &out_length)) {
|
if (!unac_string("UTF8", text, strlen(text), &out, &out_length)) {
|
||||||
|
@ -12,7 +12,9 @@ std::string removeAccents(const char *text = NULL) {
|
||||||
textWithoutAccent = string(out, out_length);
|
textWithoutAccent = string(out, out_length);
|
||||||
free(out);
|
free(out);
|
||||||
return textWithoutAccent;
|
return textWithoutAccent;
|
||||||
} if (text != NULL) {
|
}
|
||||||
|
|
||||||
|
if (text != NULL) {
|
||||||
return string(text);
|
return string(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,5 +3,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unac.h>
|
#include <unac.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
std::string removeAccents(const char *text);
|
std::string removeAccents(const char *text);
|
||||||
|
|
Loading…
Reference in New Issue