Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Ascii characters on windows XP (http://www.go4expert.com/forums/ascii-characters-windows-xp-t10846/)

charu_ja 27May2008 17:05

Ascii characters on windows XP
 
Hi
I have an application which can be installed on English, French, Japanese and German OS.
I have to identify non-Ascii characters in installation path. If installation path contains non-Ascii characters then application cannot be installed in that path. The problem is I have written a code which identifies if installation path contains non-Ascii characters.
Code:

LONG WINAPI CheckInstallDir4Unicode(MSIHANDLE hMsi)
{

        TCHAR szInstallDir[MAX_PATH];
        DWORD dwSize = MAX_PATH;
       
       
        // Get Installation directory STRING from msi
        MsiGetProperty(hMsi, _T("INSTALLDIR"),szInstallDir, &dwSize);

               
        //check for each character if it is ASCII.
        UINT i,val;
       



        for(i=0; szInstallDir[i];  i++)
        {
               
                val = (unsigned int )szInstallDir[i]; // ascii value of character at position i
               
                if(val <0 || val >127)  // CHECKING FOR ASCII VAL.
                {
                       
                        // POP A MESG THAT INSTALLATION PATH  CONTAINS
                        // NON-ASCII CHARACTER  AND BREAK
                        break;
                       
                }
               
        }
       
        return 1;


}


I test this code by giving non-Ascii characters in the installation path
such as: 奉孬艳昼臻哥棘

the code unicode checking code works fine when I run it on japanese XP VMware. but it does not work when I run this code on English xp VMware. I want the code should run in all platforms similarly. I dont know what I am missing in this code.


All times are GMT +5.5. The time now is 04:46.