Russian Windows Server 2008 - ASP script does not create correct file names on UTF-8 characters RRS feed

  • Question

  • I have a Russian 2008 server running IIS7 which is responsible for accepting user input from an embedded device. One of the arguments to the POST is the file name to 'save as' which is encoded in UTF-8. I have followed  to setup my script to process UTF-8 character. I set codepage as recommended to 65001 but then my script didn't even run. Setting the codepage to 65001 in IIS 7 seems to cause an error which I can't see in the Event Log or the IIS log. The output of the filename is garbage characters. For instance, sending one Russian character as the file name causes a two letter garbage character output file name. Here is part of my ASP code that handles opening the file name to write:

    Set objFSO= Server.CreateObject("Scripting.FileSystemObject")
    Set objFSOFile= objFSO.CreateTextFile(objFSO.BuildPath(Path, strFileName))

    "strFileName" above can be assumed to have the correct UTF-8 characters. I have verified this in a packet capture my decoding the filename UTF-8 bytes. Interestingly enough, the server accepts a metada file which includes the filename in one of the fields. Opening this in wordpad also displays the wrong file name but I was able to use a 'EdidPad Pro' to open this file and use UTF-8 option in it to correctly display the Russian file name.

    I'm out of ideas on what could be the problem so I'm putting this on the architecture category as there must be a setting in windows to correctly process UTF-8 when creating a file name.
    Thursday, July 26, 2012 1:24 PM