Tuesday, December 18, 2007

PathTooLongException: Exceeded the Maximum Path Limit of 256 Characters


The different types of paths in Windows are local file system (LFS), such as C:\File.ext, uniform naming convention (UNC), such as \\Server\Volume\File.ext, and Long UNC or UNCW, such as \\?\C:\File.ext or \\?\UNC\Server\Volume\File.ext.

One of the differences between LFS and UNC versus Long UNC is that LFS and UNC are limited, depending on the Windows version and/or individual API, to either 260 bytes in ACP format or 260 codepoints in UTF-16 format (or 260 characters in UCS-2 format). Long UNC is limited to 30,000+ codepoints in UTF-16 format (or 30,000+ characters in UCS-2 format) and must be in Unicode.

ACP stands for "ANSI Code Page", which is somewhat of a misnomer since none of the Windows code pages are actually ANSI compliant. The Windows operating system specifies a particular code page as the ACP, which then is used as the default / fallback code page for the 'A' suffixed path APIs. The ACP routines have the shortcoming in that they cannot represent all file paths that are representable in the operating system; they can only represent the character subset of Unicode UCS-2 paths which have characters in the particular code page's character set.

No comments:

Check This Out!

More Links to Good Information