nextEDGTE Technology Localization TechNotes Double byte handling issue with path name |
|||
Split path name and file name from full path name for dobule byte folder name ex. full path = c:\folder\filename.ext , and application needs to split path and file name from full name: Seeking '/' (Back slash = 0x5c ) from the back. This method works fine in single byte environment. But it does not work in double byte environment. Because '/' may appeared in tail byte of Japanese character. To prevent the issue, you have to determine if the character is tailing byte within double byte character, and seek '/' from the top as the following: Windows API isleadbyte(); can be used to determine leading byte Sample code in MBCS code: NOTE: When splitting file name and extention from full file name, it should use the same method with this sample. int i = iBackSlash =0; char cSeparator = '\\'; char *p = sFullPath; while( *p ) { // skip double byte character
// Find the last back slash in single byte character
} For more information: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt_isleadbyte.asp Split path name and file name from full path name using VC++ The best way to find out separator is using PathAddBackslash() CPath in class. For more information : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/vclrfCPathTAddBackslash.asp Copyright 2004 nextEDGE Technology, Inc. All right reserved, |
|||