ASCII file transfer

Cole, Timothy D. timothy_d_cole at md.northgrum.com
Tue Apr 4 14:30:41 GMT 2000


> -----Original Message-----
> From:	Rama Ganesh [SMTP:ganeshrama at hotmail.com]
> Sent:	Monday, April 03, 2000 23:36
> To:	Multiple recipients of list SAMBA-NTDOM
> Subject:	ASCII file transfer
> 
> Sql files(.SQL) created on UNIX, seem to contain some special characters 
> when opened on Win NT. Binary files are fine.
> 
	This is a FAQ.  NT and POSIX-compliant (e.g. Unix) systems use
different characters to terminate lines.

> Is anyone aware of a workaround to this issue ?
> 
	Not any reliable ones.  It's not an issue specific to Samba -- it's
been around for at least the past 20 years, and probably more, any place
people were moving data between DOS/Windows/VMS and POSIX/Unix.  

	Every attempt to automatically solve it has failed miserably,
because if the system guesses wrong and the file is really binary, it will
be corrupted.  For example, the (off by default) conversion in the Linux
msdos fs driver was removed entirely because too many people were having
problems with data corruption.

	Even if the conversion always guesses right, if this is being done
transparently in the filesystem (or in Samba) the conversion also changes
the effective length of the file (NT uses two characters, Unix uses one),
the length of individual lines, and thus file offsets change unpredictably.
seek() can't work reliably under those circumstances, and so you're STILL at
the risk of data corruption.

	So that's why Samba doesn't even try to convert text files.

	The only reliable way to deal with this is to get a conversion
program of some sort that you can manually run the file through on the NT
side (or on the Unix side, if you're taking files the other way, from NT to
Unix).  Plenty exist, and there are also editors like UltraEdit which will
let you convert files too.  Check winfiles.com.

	Sorry there isn't an easier solution.  It's a 20-year-old problem;
if anyone ever manages to solve it reliably, they would deserve a Nobel
Prize in information theory.



More information about the samba-ntdom mailing list