Windows API Internationalization Programming
UNICODE Handling

Handling UNICODE in windows primarily needs vast knowledge and understanding, but here we will only introduce basic issues. The purpose for handling UNICODE is to process different language data as a unified one.

  1. Use TCHAR For String

  2. Make a Process Covering TCHAR

  3. Add UNICODE Option

The mapping between multi-byte function and both UNICODE and TCHAR are listed below.
----------------------------------------
Multi-byte    UNICODE        TCHAR            
----------------------------------------
strcpy        wcscpy         _tcscpy         
strncpy       wcsncpy        _tcsncpy        
strcat        wcscat         _tcscat         
strncat       wcsncat        _tcsncat        
strlen        wcslen         _tcslen         
strcmp        wcscmp         _tcscmp         
strncmp       wcsncmp        _tcsncmp        
strstr        wcsstr         _tcsstr         
sscanf        swscanf        _tscanf         
sprintf       swprintf       _stprintf       
_scprintf     _scwprintf     _sctprintf      
strtok        wcstok         _tcstok         
strchr        wcschr         _tcschr         
_strdup       _wcsdup        _tcsdup         
printf        wprintf        _tprintf        
scanf         wscanf         _tscanf         
std::cout     std::wcout      None              
std::cin      std::wcin       None              
fopen         _wfopen        _tfopen         
fprintf       fwprintf       _ftprintf       
fputs         fputws         _fputts         
fgets         fgetws         _fgetts         
fscanf        fwscanf        _ftscanf       
fgetc         fgetwc         _fgettc     
fputc         fputwc         _fputtc     
getc          fgetwc         _gettc      
getchar       getwchar       _gettchar   
gets          getws          _getts      
putc          putwc          _puttc      
puts          putws          _putts      
strtod        wcstod         _tcstod     
strtol        wcstol         _tcstol     
strtoul       wcstoul        _tcstoul    
atof          _wtof          _tstof      
atol          _wtol          _tstol, _ttol         
atoi          _wtoi          _tstoi, _ttoi      
system        _wsystem       _tsystem    
----------------------------------------

Go to Internationalization Programming Top


Copyright (C) 2012 Kokusaika JP, Inc.
All rights reserved. No reproduction or republication without written permission.