Subject: Re: [netatalk-admins] iso filnames?
From: Palle Girgensohn (girgen@partitur.se)
Date: Mon Dec 29 1997 - 20:40:15 EST
Hi Bill,
Bill Studenmund wrote:
>
> On Tue, 30 Dec 1997, Palle Girgensohn wrote:
>
> > Hello again!
> >
> > > If you can find out which files you edited, I'll be much obliged!
> > > Thanks!
> >
> > 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?
>
> Are we talking about characters which are normally valid for both MacOS
> 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.
> > I thought there are already features in samba and netatalk (samba I think)
> 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, 0x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C6, 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
This archive was generated by hypermail 2b28 : Sat Dec 18 1999 - 16:28:33 EST