Subject: [netatalk-admins] iso filnames?

From: Palle Girgensohn <[email-masked]>
Date: Mon, 29 Dec 1997 20:45:36 +0100

Hi!

Has anybody done any work to get netatalk to translate filenames to iso
characters instead of the default :nn hexadecimal representation? This
would help us a lot, since we use both macs and windows machines, as
well as unix workstations. For windows, we use use Samba w/ "character
set = iso8859-1". Is there something similar for the mac? Any ideas
where in the code this conversion happens?

You may think that this is not important, but asking a Swede not to use
å, ä and ö is like asking an American not to use a, q and j in
filenames. It just won't work.  ;-) 

WindowsNT does this smoothly, and I'd really like to see netatalk/unix
compare to it.

Thanks
Palle

---

From: "Joakim Ahlen" <[email-masked]>
Date: Mon, 29 Dec 1997 23:27:53 +0000

> where in the code this conversion happens?

Hi Palle, as a fellow swede i've struggled with this problem too. My 
problem was that our backup on our NT-machine, running over samba 
taking backup of the files on our unix, couldn't take backup of 
files with ':' in the filename. I poked around in the netatalk
code and found a way to change the colon into a percent-sign, so that 
i file could look like "Sp%85r" instead of "Sp:85r". It worked 
fine, only trouble with that, was that i couldn't get netatalk to 
read both files with % and : in them, and I didn't want to remake 
the entire filesystem and changing the name of all files - just too 
risky. 

I can find out which functions in the netatalk-code i edited, and you 
can try and fix them up for use with 8859-1. I'm a lousy 
C-programmer, but if you manage to get some improvements in the code, 
please keep me posted, ok?

Oh, and by the way, Gott nytt år! ;)

//Jocke

Joakim Ahlen
MediaPrint, Uddevalla AB
Fax: +46 522 19276
email: [email-masked]

---

From: Palle Girgensohn <[email-masked]>
Date: Tue, 30 Dec 1997 00:04:05 +0100

Tjenare Joakim!

If you can find out which files you edited, I'll be much obliged!
Thanks!

And Gott nytt år!

/palle

---

From: Palle Girgensohn <[email-masked]>
Date: Tue, 30 Dec 1997 00:56:02 +0100

Hello again!

> If you can find out which files you edited, I'll be much obliged!

found them:

etc/afpd/desktop.c I guess... mtoupath and utompath seem to contain all
that's necessary (i *think*).

So, now it's just to decide how to convert the special cases: / :
starting dot and characters not existing in both character sets. Any
suggestions?

/palle

---

From: Bill Studenmund <[email-masked]>
Date: Mon, 29 Dec 1997 16:55:10 -0800 (PST)

> starting dot and characters not existing in both character sets. Any

Are we talking about characters which are normally valid for both MacOS
and Windows (though with different codes)?

I thought there are already features in samba and netatalk (samba I think) 
to generate and parse file names which they both can understand.

Take care,

Bill

---

From: Palle Girgensohn <[email-masked]>
Date: Tue, 30 Dec 1997 02:40:15 +0100

Hi Bill,

> and Windows (though with different codes)?

No. I think the chars like (tm) that are not in the iso set. Below is a
snippet of code from cap, the other free unix appleshare package, that
has macroman<->iso8859-1 support. It's a pair of tables for translating
between the two charsets.

> to generate and parse file names which they both can understand.

I don't think so, but please prove me wrong; I'll save some work :).

Samba defaults to using the DOS charset, but it can be configed to use
iso-latin-1 by specifying "character set iso8859-1" in the smb.conf
file.

Netatalk translates non-ascii characters to ":xx", where xx is the
hexadecimal representation of the character in the MacRoman charset. I
checked the netatalk c code in etc/afpd/desktop.c (funcs mtoupath and
utompath), and this is the only way it is programmed; there are no
alternatives as of now.

Now, the snippet:

/*
 * Table for translating Macintosh characters 0x80-0xff to ISO
 * (Macintosh characters 0x00-0x7f map directly to ISO equivalent).
 *
 * The top half of the table contains 0x00 in positions where
 * no reversible character mapping exists, the bottom half of
 * the table contains a reversible mapping for text translation.
 
ermm, it seemes to be the other way around? bottom half contains zeroes.
/palle

 *
 */

u_char Mac2ISO[256] = {
      0xC4, 0xC5, 0xC7, 0xC9, 0xD1, 0xD6, 0xDC, 0xE1,  /* 80 - 87 */
      0xE0, 0xE2, 0xE4, 0xE3, 0xE5, 0xE7, 0xE9, 0xE8,  /* 88 - 8F */
      0xEA, 0xEB, 0xED, 0xEC, 0xEE, 0xEF, 0xF1, 0xF3,  /* 90 - 97 */
      0xF2, 0xF4, 0xF6, 0xF5, 0xFA, 0xF9, 0xFB, 0xFC,  /* 98 - 9F */
      0x84, 0xB0, 0xA2, 0xA3, 0xA7, 0xB7, 0xB6, 0xDF,  /* A0 - A7 */
      0xAE, 0xA9, 0x85, 0xB4, 0xA8, 0xAD, 0xC6, 0xD8,  /* A8 - AF */
      0x86, 0xB1, 0xB2, 0xB3, 0xA5, 0xB5, 0x87, 0x88,  /* B0 - B7 */
      0xBC, 0xB9, 0xBE, 0xAA, 0xBA, 0xBD, 0xE6, 0xF8,  /* B8 - BF */
      0xBF, 0xA1, 0xAC, 0x89, 0x8A, 0x8B, 0x8C, 0xAB,  /* C0 - C7 */
      0xBB, 0x8D, 0xA0, 0xC0, 0xC3, 0xD5, 0x8E, 0x8F,  /* C8 - CF */
      0xD0, 0x90, 0x91, 0x92, 0x93, 0x94, 0xF7, 0xD7,  /* D0 - D7 */
      0xFF, 0xDD, 0x2F, 0xA4, 0x3C, 0x3E, 0xDE, 0x95,  /* D8 - DF */
      0x96, 0x97, 0x98, 0x99, 0x9A, 0xC2, 0xCA, 0xC1,  /* E0 - E7 */
      0xCB, 0xC8, 0xCD, 0xCE, 0xCF, 0xCC, 0xD3, 0xD4,  /* E8 - EF */
      0xF0, 0xD2, 0xDA, 0xDB, 0xD9, 0x9B, 0x5E, 0x7E,  /* F0 - F7 */
      0xAF, 0x9C, 0x9D, 0x9E, 0xB8, 0xFD, 0xFE, 0x9F,  /* F8 - FF */

      0xC4, 0xC5, 0xC7, 0xC9, 0xD1, 0xD6, 0xDC, 0xE1,  /* 80 - 87 */
      0xE0, 0xE2, 0xE4, 0xE3, 0xE5, 0xE7, 0xE9, 0xE8,  /* 88 - 8F */
      0xEA, 0xEB, 0xED, 0xEC, 0xEE, 0xEF, 0xF1, 0xF3,  /* 90 - 97 */
      0xF2, 0xF4, 0xF6, 0xF5, 0xFA, 0xF9, 0xFB, 0xFC,  /* 98 - 9F */
      0x00, 0xB0, 0xA2, 0xA3, 0xA7, 0xB7, 0xB6, 0xDF,  /* A0 - A7 */
      0xAE, 0xA9, 0x00, 0xB4, 0xA8, 0x00, 0xC6, 0xD8,  /* A8 - AF */
      0x00, 0xB1, 0x00, 0x00, 0xA5, 0xB5, 0x00, 0x00,  /* B0 - B7 */
      0x00, 0x00, 0x00, 0xAA, 0xBA, 0x00, 0xE6, 0xF8,  /* B8 - BF */
      0xBF, 0xA1, 0xAC, 0x00, 0x00, 0x00, 0x00, 0xAB,  /* C0 - C7 */
      0xBB, 0x00, 0xA0, 0xC0, 0xC3, 0xD5, 0x00, 0x00,  /* C8 - CF */
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7, 0x00,  /* D0 - D7 */
      0xFF, 0x00, 0x2F, 0xA4, 0x3C, 0x3E, 0x00, 0x00,  /* D8 - DF */
      0x00, 0x00, 0x00, 0x00, 0x00, 0xC2, 0xCA, 0xC1,  /* E0 - E7 */
      0xCB, 0xC8, 0xCD, 0xCE, 0xCF, 0xCC, 0xD3, 0xD4,  /* E8 - EF */
      0x00, 0xD2, 0xDA, 0xDB, 0xD9, 0x00, 0x5E, 0x7E,  /* F0 - F7 */
      0xAF, 0x00, 0x00, 0x00, 0xB8, 0x00, 0x00, 0x00   /* F8 - FF */
};

/*
 * Table for translating ISO characters 0x80-0xff to Macintosh
 * (ISO characters 0x00-0x7f map directly to Macintosh equivalent).
 *
 * The top half of the table contains 0x00 in positions where
 * no reversible character mapping exists, the bottom half of
 * the table contains a reversible mapping for text translation.
 *
 */

u_char ISO2Mac[256] = {
      0x00, 0x00, 0x00, 0x00, 0xA0, 0xAA, 0xB0, 0xB6,  /* 80 - 87 */
      0xB7, 0xC3, 0xC4, 0xC5, 0xC6, 0xC9, 0xCE, 0xCF,  /* 88 - 8F */
      0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xDF, 0xE0, 0xE1,  /* 90 - 97 */
      0xE2, 0xE3, 0xE4, 0xF5, 0xF9, 0xFA, 0xFB, 0xFF,  /* 98 - 9F */
      0xCA, 0xC1, 0xA2, 0xA3, 0xDB, 0xB4, 0x7C, 0xA4,  /* A0 - A7 */
      0xAC, 0xA9, 0xBB, 0xC7, 0xC2, 0xAD, 0xA8, 0xF8,  /* A8 - AF */
      0xA1, 0xB1, 0xB2, 0xB3, 0xAB, 0xB5, 0xA6, 0xA5,  /* B0 - B7 */
      0xFC, 0xB9, 0xBC, 0xC8, 0xB8, 0xBD, 0xBA, 0xC0,  /* B8 - BF */
      0xCB, 0xE7, 0xE5, 0xCC, 0x80, 0x81, 0xAE, 0x82,  /* C0 - C7 */
      0xE9, 0x83, 0xE6, 0xE8, 0xED, 0xEA, 0xEB, 0xEC,  /* C8 - CF */
      0xD0, 0x84, 0xF1, 0xEE, 0xEF, 0xCD, 0x85, 0xD7,  /* D0 - D7 */
      0xAF, 0xF4, 0xF2, 0xF3, 0x86, 0xD9, 0xDE, 0xA7,  /* D8 - DF */
      0x88, 0x87, 0x89, 0x8B, 0x8A, 0x8C, 0xBE, 0x8D,  /* E0 - E7 */
      0x8F, 0x8E, 0x90, 0x91, 0x93, 0x92, 0x94, 0x95,  /* E8 - EF */
      0xF0, 0x96, 0x98, 0x97, 0x99, 0x9B, 0x9A, 0xD6,  /* F0 - F7 */
      0xBF, 0x9D, 0x9C, 0x9E, 0x9F, 0xFD, 0xFE, 0xD8,  /* F8 - FF */

      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 80 - 87 */
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 88 - 8F */
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 90 - 97 */
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  /* 98 - 9F */
      0xCA, 0xC1, 0xA2, 0xA3, 0xDB, 0xB4, 0x7C, 0xA4,  /* A0 - A7 */
      0xAC, 0xA9, 0xBB, 0xC7, 0xC2, 0x00, 0xA8, 0xF8,  /* A8 - AF */
      0xA1, 0xB1, 0x00, 0x00, 0xAB, 0xB5, 0xA6, 0xA5,  /* B0 - B7 */
      0xFC, 0x00, 0xBC, 0xC8, 0x00, 0x00, 0x00, 0xC0,  /* B8 - BF */
      0xCB, 0xE7, 0xE5, 0xCC, 0x80, 0x81, 0xAE, 0x82,  /* C0 - C7 */
      0xE9, 0x83, 0xE6, 0xE8, 0xED, 0xEA, 0xEB, 0xEC,  /* C8 - CF */
      0x00, 0x84, 0xF1, 0xEE, 0xEF, 0xCD, 0x85, 0x00,  /* D0 - D7 */
      0xAF, 0xF4, 0xF2, 0xF3, 0x86, 0x00, 0x00, 0xA7,  /* D8 - DF */
      0x88, 0x87, 0x89, 0x8B, 0x8A, 0x8C, 0xBE, 0x8D,  /* E0 - E7 */
      0x8F, 0x8E, 0x90, 0x91, 0x93, 0x92, 0x94, 0x95,  /* E8 - EF */
      0x00, 0x96, 0x98, 0x97, 0x99, 0x9B, 0x9A, 0xD6,  /* F0 - F7 */
      0xBF, 0x9D, 0x9C, 0x9E, 0x9F, 0x00, 0x00, 0xD8   /* F8 - FF */
};

Regards,
Palle

---

From: Julian Elischer <[email-masked]>
Date: Mon, 29 Dec 1997 19:51:14 -0800 (PST)

Whistle (www.whistle.com) added ISO code support for 
netatalk and SAMBA so that our products (in Norway actually)
can exchange files between PCs and MACs and see the same name on both.
As teh SAMBA co-ordinator works for us teh samba patches ar enow part of
the mainstream samba, but teh netatalk patches are not yet integrated.

send me email if you want the changes (relative to 1.4b2(approx))

I may need some days to get them together however. as everyone is away for
holidays.
 The advantage with these patches is that they interact perfectly with teh
samba codepages of the same name :)

julian

---

From: Palle Girgensohn <[email-masked]>
Date: Tue, 30 Dec 1997 11:24:53 +0100

Hello Julian,

Yes, I would be much obliged. Please send them. I suggest including the
patches in the netatalk distribution, BTW.

Best regards, and a happy new year!

/Palle

---

From: Osma Ahvenlampi <[email-masked]>
Date: 31 Dec 1997 12:47:11 +0200

> As teh SAMBA co-ordinator works for us teh samba patches ar enow part of

I would also be interested in these patches. Sounds like it would be
helpful to many if you could put them on a web page somewhere..

-- 
Possessor of a mind not merely twisted but actually sprained.
Osma Ahvenlampi <[email-masked]>