Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hactool fails on user accounts with special characters #31

Open
HelloOO7 opened this issue Jun 28, 2018 · 5 comments
Open

Hactool fails on user accounts with special characters #31

HelloOO7 opened this issue Jun 28, 2018 · 5 comments

Comments

@HelloOO7
Copy link

HelloOO7 commented Jun 28, 2018

The program can't open and just says:
Cannot convert "C:\Users\Čeněk" to UTF-16

@Rempa212
Copy link

Got the same problem with the "é" in "Rémi"

@pekempy
Copy link

pekempy commented Dec 29, 2018

Still happening with latest release with "ý"

@shadow2560
Copy link

This problem is always present in the version 1.3.2.

@gyorokpeter
Copy link

It is because the program assumes that the paths read from %HOME%, %USERPROFILE% etc. are in UTF-8, while normally they are in your system locale. I changed the code to the following in filepath.c, not sure if it doesn't introduce any other bugs:

void os_strcpy(oschar_t *dst, const char *src) {
#ifdef _WIN32
    if (src == NULL) return;
    size_t srcLen = strlen(src);
    int requiredSize = MultiByteToWideChar(CP_ACP,0,src,srcLen,0,0);
    if (requiredSize > MAX_PATH-1) {
        fprintf(stderr, "Failed to convert %s to UTF-16: required size too large!\n", src);
        exit(EXIT_FAILURE);
    }
    int retval = MultiByteToWideChar(CP_ACP,0,src,srcLen,dst,requiredSize);
    if (!retval) {
        fprintf(stderr, "Failed to convert %s to UTF-16!\n", src);
        exit(EXIT_FAILURE);
    }
#else
    strcpy(dst, src);
#endif
}

@ifyum
Copy link

ifyum commented May 14, 2023

it happens to me with the _

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants