This is driving me a little mad, and it has come to a point where I just want to work around the problem instead of trying to fix it in C code, which seems impossible.
I've been reading
Getting the correct Unicode path within an ISAPI filter — kirit.com
which are discussing ISAPI and unicode. However even when I use UNICODE_URL as recommended in the article I cannot reach 日本語.jpg on IIS 7.0. When using UNICODE_URL the URL should be in UTF16 apparently, I tried:
Code:
char pathToFile[1000]
DWORD pathToFileSize = sizeof(pathToFile);
pECB->GetServerVariable(pECB->ConnID, "UNICODE_URL",
pathToFile, &pathToFileSize);
HANDLE fileHandle;
fileHandle = CreateFileA(pathToFile, ~etc...);
if (fileHandle==INVALID_HANDLE_VALUE) {
wchar_t unicodeFilePath[1000];
MultiByteToWideChar(CP_UTF8, 0, pathToFile, 1000, unicodeFilePath, 1000);
fileHandle = CreateFileW(unicodeFilePath, ~etc...);
}
But it didn't work. CP_UTF16 doesn't exist either, tried writing the number 1200 as this table...
Constant Field Values (POI API Documentation)
...shows, I assume its correct to do so but its probably not, sigh. Whatever.
It takes ages to test this stuff out also, I make changes on Win XP where all my project files are and then I have to transfer and set everything up on Vista just to see that it made no change. Probably won't work on Server 2003 later where this project will run its life.
So, what I'm thinking now is that maybe I can work around these ancient C problems with Unicode with a little JavaScript, nay?
On the HTML page, on Vista where the image URL turns up as "???.jpg", if I run this:
<script>alert(document.location.href);</script>
I see the japanese letters. So if I somehow can turn these japanese letters from "日本語" to "日本語" in JavaScript I can stick them into the image, replacing "???" and thus showing the image. With luck the end user wont even know the switch has been made, I know it's a cheezy solution but I just want it to work at this point. Won't be that many unicode file names anyway.
So,
anyone here know how "日本語" could be transformed to "日本語" using JavaScript?
I know this is a C board but maybe I'll get lucky. Of course I'm still open for good solution to the real problem also (making it possible to find the file in the ISAPI extension).