mirror of
https://github.com/Artikash/Textractor.git
synced 2024-12-24 01:14:12 +08:00
google translate error handling
This commit is contained in:
parent
1312a80ddd
commit
fffb63edf4
@ -80,9 +80,12 @@ extern "C"
|
|||||||
WinHttpReceiveResponse(request, NULL);
|
WinHttpReceiveResponse(request, NULL);
|
||||||
WinHttpReadData(request, buffer, 10000, &bytesRead);
|
WinHttpReadData(request, buffer, 10000, &bytesRead);
|
||||||
// Response formatted as JSON: starts with '[[["'
|
// Response formatted as JSON: starts with '[[["'
|
||||||
MultiByteToWideChar(CP_UTF8, 0, buffer + 4, (int)((strstr(buffer, "\",\"")) - (buffer + 4)), translation, 10000);
|
if (buffer[0] == '[')
|
||||||
message = translation;
|
{
|
||||||
for (int i = -1; translation[++i];) if (translation[i] == L'\\') translation[i] = 0x200b;
|
MultiByteToWideChar(CP_UTF8, 0, buffer + 4, (int)((strstr(buffer, "\",\"")) - (buffer + 4)), translation, 10000);
|
||||||
|
message = translation;
|
||||||
|
for (int i = -1; translation[++i];) if (translation[i] == L'\\') translation[i] = 0x200b;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
WinHttpCloseHandle(request);
|
WinHttpCloseHandle(request);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user