Compartilhar via


File Name Translation revisited

I had discussed on using File Name Translation over NFS here. Some additional information and an alternative steps is captured in this post.

To start with the characters that are supported by Windows are here: https://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx

The lists of invalid / reserved characters are:

 

  • < (less than)
  • > (greater than)
  • : (colon)
  • " (double quote)
  • / (forward slash)
  • \ (backslash)
  • | (vertical bar or pipe)
  • ? (question mark)
  • * (asterisk)

 

On the other hand the only characters not allowed in a filename in *nix are “NULL” and “/”

 

Enabling File Name Character Translation is discussed here: https://support.microsoft.com/kb/289627

Few important things to remember here is : Windows and UNIX operating systems have restrictions on valid characters that can be used in a file name. The list of illegal characters for each operating system, however, is different. For example, a UNIX file name can use a colon (:), but a Windows file name cannot use a colon (:). If a UNIX user attempts to create a file with a Windows illegal character on a Windows Services for UNIX network file system (NFS) share, the attempt is unsuccessful and the UNIX client computer receives an input or output error.

To work around this issue, use file name character mapping to replace characters that are not legal.

To enable file name character mapping, we need to create a character translation file and add a registry entry (one of the ways); another is using NFS management console.

A file name character translation file is a text file with a list of mapped characters in the following format where nn is the hexadecimal value of a single-byte character or one byte of a double-byte character, and comment is an optional comment:

 0xnn[ 0xnn] : 0xnn[ 0xnn] [ ; comment]

 * A single-byte character can be mapped to another single-byte character or to a double-byte character.

 * A double-byte character can be mapped to another double-byte character or to a single-byte character.

 * A semicolon (;) in the map file indicates a comment. Everything from the semicolon (;) to the end of the line is ignored.

The first character in the entry is the character on the (UNIX) client and the second is the character used on the Windows-based Server for NFS computer.

 For example, the following maps the UNIX colon (:) to a Windows dash (-):

 0x3a : 0x2d ; replace client : with - on server

 Hexadecimal values can be easily obtained by using the Character Map utility that comes with Windows. Open Character Map and select a character. In the bottom left corner of the program, the character code displays the hexadecimal value of the character.

 When we have created the file name character translation file, we must specify its name location in the system registry. To register the path and name of the file:

1.Use Registry Editor to locate this registry key: HKEY_LOCAL_MACHINE\Software\Microsoft\Server For NFS\CurrentVersion\Mapping

2.Edit the CharacterTranslation (REG_SZ) value.

3.Enter the fully qualified path name of the file name character translation file. For example, C:\Sfu\CTrans.txt.

Most importantly, we cannot replace a valid character in Windows using this.