I am sending a request using libcurl in windows and the response I get has some universal characters in them that start with \u
. Libcurl is not recognizing this universal character and as a result, it escapes the \ turning the universal character to \\u
.
Is there any way to fix this? I have tried using str.replace
but it can not replace escaped sequences
the code I used to implent this was
#include <iostream>
#include <string>
#include <cpr/cpr.h>
int main()
{
auto r = cpr::Get(cpr::Url{"http://prayer.osamaanees.repl.co/api"});
std::string data = r.text;
std::cout << data << std::endl;
return 0;
}
This code uses the cpr library which is a wrapper for curl. It prints out the following:
{
"times":{"Fajr":"04:58 AM","Sunrise":"06:16 AM","Dhuhr":"12:30 PM","Asr":"04:58 PM","Maghrib":"06:43 PM","Isha":"08:00 PM"},
"date":"Tuesday, 20 Mu\u1e25arram 1442AH"
}
Notice the word Mu\u1e25arram
, it should have been Muḥarram but since curl escaped the \ before u it prints out as \u1e25