Thread: ISAPI unicode filenames

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    8

    Talking

    Got it working, thanks!

    What I'm doing is this right before I use CreateFileW:

    Code:
    wchar_t dst[1000];
    MultiByteToWideChar(CP_UTF8, 0, filePath, 1000, dst, 1000);
    "filePath" is "char *filePath" in the function, which was declared as "char filePath[1000]" outside the function. I assume "wchar_t dst" doesn't need more than 1000 in length. Or does it need double (or half)?

    First I try to open the file with CreateFileA, if that fails I try to open the file with CreateFileW. If I didn't do it like that I couldn't open file named like so: "åäö.jpg".

    I don't really get why CreateFileW works with japanese characters and normal characters (a-z) but not with "å" or "ì" for example. CreateFileW works when the file name is "åäö日本語.jpg". I guess the DLL is being sent characters encoded differently?

    Well, it works like it is now, by using both CreateFileA and CreateFileW. Always thought it was strange that Windows uses UTF16 and not UTF8 which I think look superior.

    Thanks again gentlemen!

    Edit: Sorry for my late reply, I have been busy and haven't checked for replies until just now.

  2. #2
    Registered User
    Join Date
    Nov 2009
    Posts
    8
    This is odd, some seem to work other doesn't seem to work. Also it seem to work for some on Windows XP that doesn't work at all on Windows Vista.

    Here's a few file names that I can't get a handle for:

    ( ゚ 3゚) ( ´ -`) (☞゚∀゚)☞ ( ゚ Д゚).jpg
    (¯`·.¸«FILENAME»¸.·´¯).jpg
    ( ゚Д゚)ァハハ八八ノヽノヽノヽノ \ \ \.jpg
    -´¯`·~☆★BLAH★☆~·´¯`-.jpg
    █▄ ██ █▄.jpg
    ಥ﹏ಥ.jpg

    Any ideas? Those are strange file names I know but it would be cool if they worked as well.

    In addition, on Windows XP I can access "日本語.jpg" (prints as "日本語.jpg"), but on Windows Vista I can't access "日本語.jpg" (prints as "???.jpg"). I don't know what is going on.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. <string> to LPCSTR? Also, character encoding: UNICODE vs ?
    By Kurisu33 in forum C++ Programming
    Replies: 7
    Last Post: 10-09-2006, 12:48 AM
  2. Unicode - a lot of confusion...
    By Jumper in forum Windows Programming
    Replies: 11
    Last Post: 07-05-2004, 07:59 AM
  3. Should I go to unicode?
    By nickname_changed in forum C++ Programming
    Replies: 10
    Last Post: 10-13-2003, 11:37 AM
  4. UNICODE and windows.h help
    By nextus in forum Windows Programming
    Replies: 3
    Last Post: 03-02-2003, 03:13 PM
  5. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM

Tags for this Thread