Samba Catia Mappings and Norwegian Characters
By hernil
From the Catia docs:
The Catia CAD package commonly creates filenames that use characters that are illegal in CIFS filenames. The vfs_catia VFS module implements a character mapping so that these files can be shared with CIFS clients.
Turns out there’s a big gotcha for some special characters - in this case for the Norwegian character “ø” which ends up failing more or less silently when trying to manipulate files with this character over Samba.
Typical config
A typical config of Catia for a given share looks like this (taken from the docs)
[CAD]
path = /data/cad
vfs objects = catia
catia:mappings = 0x22:0xa8,0x2a:0xa4,0x2f:0xf8,0x3a:0xf7,0x3c:0xab,0x3e:0xbb,0x3f:0xbf,0x5c:0xff,0x7c:0xa6
What this does is mapping each pair of characters from a to b using hex codes.
0x3a:0x5f
for example maps :
to _
(colon to underscore) - a very important mapping as colon is not a valid character in cifs but very much allowed on a unix file system and indeed commonly used as they are observed in ISO-8601 date representations.
The problem
Our problem is related to the following mapping:
0x2f:0xf8
Which maps the character /
to ø
. This causes problems for files containing the character in its own right which will manifest in several ways. Notably issues displaying and manipulating files with the character on the file share.
Valid Norwegian-friendly config
[CAD]
path = /data/cad
vfs objects = catia
catia:mappings = 0x22:0xa8,0x2a:0xa4,0x2f:0x3d,0x3a:0xf7,0x3c:0xab,0x3e:0xbb,0x3f:0xbf,0x5c:0xff,0x7c:0xa6
Replacing this mapping with 0x2f:0x3d
where 0x3d
is =
. I get how ø
is a better visual replacement for /
but that form will be sacrified on the alter of function in this case.
Postscript
One sentence to note that the ø
character also occurs in Danish and might turn out to cause problems for a Dane some day.
And here is the full list of characters going in and out of the mapping in case someone hits this issue from another angle (character).
" (Quotation mark)
¨ (Diaeresis)
* (Asterisk)
¤ (Currency sign)
/ (Solidus or Slash)
ø (Latin small letter o with stroke)
: (Colon)
÷ (Division sign)
< (Less-than sign)
« (Left-pointing double angle quotation mark)
> (Greater-than sign)
» (Right-pointing double angle quotation mark)
? (Question mark)
¿ (Inverted question mark)
ÿ (Latin small letter y with diaeresis)
| (Vertical bar or Pipe)