Advertisement

Charsets Windows and Linux

Started by May 11, 2005 01:45 AM
4 comments, last by jflanglois 19 years, 4 months ago
Hi! I am currently developing cross platform because i am a linux addict and my project for a course has to compile on VS .NET 2003. Now everytime i move my files to windows or back again i get those annoying NULL characters ( ^@ ) at the end of the file and line feed symbols ( ^M ). I am developing using emacs and gcc on linux and of course VS .NET 2003 on the windows side. I tried recode but i think i am using it wrong because nothing changes:

recode -v windows-1252.. foo.hh
or
recode -v windows-1252..latin1 foo.hh
of
recode -v windows-1252..utf8 foo.hh
Any help appreciated! THX!
i saw a day a magical command under emacs which suppressed all ^M in a buffer, but i do not remember what it was. What i do is a M-x replace-string ^M by nothing... but well if you find a better method i'll be interested.
Tchou kanaky ! tchou !
Advertisement
Dunno if this comes standard on all *nix distros, but have you tried dos2unix?


jfl.
i heard that dos2unix was replaced with recode so i didn't actually look further but i think i should now :)
dos2unix is available and i have Suse 9.1:
dos2unix -o * 

... removed the line feeds ( ^M ). This command also removes all rights except read and write rights for the owner but it doesn't change the rights of folders which i find pretty handy because when copying from windows everyone has read, write and execute rights on all files.


...but the null characters ( ^@ ) are still there.
They luckily only mess up the compilation output but i find them most annoying for instance when searching for other warnings or errors.

math/OVmath.hh:39:1: warning: null character(s) ignoredmath/OVmath.hh:39:1: warning: no newline at end of filemath/OVmath.cc:28:1: warning: null character(s) ignoredmath/OVmath.cc:28:1: warning: no newline at end of file
Yeah, it seems to have trouble with the last line. When in Windows, make it a habit of just adding a line to the end of the source file. An alternative is loading it in vi (I suppose vim will do the same thing) and resave it, it should fix the last line.


jfl.

This topic is closed to new replies.

Advertisement