Ascii characters on windows XP

Discussion in 'C' started by charu_ja, May 27, 2008.

  1. charu_ja

    charu_ja New Member

    Joined:
    May 27, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice