Skip to content

Instantly share code, notes, and snippets.

@FlyTechVideos
Created June 26, 2023 22:40
Show Gist options
  • Save FlyTechVideos/ac708e977bd2aa73861b1936bf757255 to your computer and use it in GitHub Desktop.
Save FlyTechVideos/ac708e977bd2aa73861b1936bf757255 to your computer and use it in GitHub Desktop.
Calls IsTextUnicode from the WinAPI to figure out whether or not a text is recognized as Unicode. Meant for use in Windows XP.
#include "stdafx.h"
#include <windows.h>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
cout << "\r\n";
if (argc != 2) {
cout << " Usage: " << argv[0] << " \"Text to verify\"\r\n\r\n";
return 1;
}
char* string_to_check = argv[1];
char* result = IsTextUnicode(string_to_check, strlen(string_to_check), NULL) == 1 ? "YES" : "NO";
cout << " String: " << string_to_check << endl;
cout << " IsTextUnicode: " << result;
std::cout << "\r\n\r\n";
return 0;
}
@heybro784
Copy link

Can you add an EXE version for Windows 10?

@lolkalix
Copy link

lolkalix commented Jan 3, 2024

Can you add an EXE version for Windows 10?

yes you can, the code works in windows 10 too

@FlyTechVideos
Copy link
Author

Can you add an EXE version for Windows 10?

yes you can, the code works in windows 10 too

Yes, it does work in Windows 10 too, just keep in mind that the fault in the function was fixed. Therefore, "Bush hid the facts" and similar strings don't trigger a false positive anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment