I am trying to remove utf-8 characters from json data but i get error shown below ;
invalid conversion from 'const char*' to 'char*' [-fpermissive]
and to get json data I am using the code below ;
memset(json,0,sizeof(json));
msg.toCharArray(json, 400);
deserializeJson(doc, json);
JsonObject LEAVE = doc["DATA"][0];
const char* NAME = LEAVE["NAME"];
diacriticalStripper (NAME, strlen(NAME)); ///this is where I get error
to remove utf-8 data from json string I am using code below ;
void diacriticalStripper (char Text[], int TextLength) {
int i = 0;
do {
char c = Text[i];
if ((uint8_t)c == 195) { // diacritical code?
char c2 = Text[i + 1]; // yes, convert next character
switch ((uint8_t)c2) {
case 160 ... 166:
Text[i] = 'a';
break;
case 167:
Text[i] = 'c';
break;
case 168 ... 171:
Text[i] = 'e';
break;
case 172 ... 175:
Text[i] = 'i';
break;
case 177:
Text[i] = 'n';
break;
case 178 ... 182:
Text[i] = 'o';
break;
case 185 ... 188:
Text[i] = 'u';
break;
case 189 ... 191:
Text[i] = 'y';
break;
case 128 ... 134:
Text[i] = 'A';
break;
case 135:
Text[i] = 'C';
break;
case 136 ... 139:
Text[i] = 'E';
break;
case 140 ... 143:
Text[i] = 'I';
break;
case 146 ... 150:
Text[i] = 'O';
break;
case 153 ... 156:
Text[i] = 'U';
break;
default:
break;
}
for (int j = i + 1; j < TextLength; j++) Text[j] = Text[j + 1];
TextLength --;
}
i++;
} while (i < TextLength);
}
I tried some other convertions but all gave error...
Thanks in advance