LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   file encoding..?? (https://www.linuxquestions.org/questions/linux-general-1/file-encoding-599122/)

peedaro 11-12-2007 02:51 PM

file encoding..??
 
hi..i saved a document in openoffice.org...copied it onto a cd..
and pasted this document in xp..it opened in MSWORD..
BUT IT IS IN SOME ENCRYPTED fashion..
which option do i hafta click to get my original document..??
i tried all three
windows(default) msdos other encoding
none of these will decrypt it..:scratch:

pljvaldez 11-12-2007 03:42 PM

Which document format did you save it as? You can save it as *.rtf (rich text format) or as *.doc from OpenOffice and those should open just fine in MS Word. If you used the standard open office format, however, Word can't open it.

peedaro 11-13-2007 12:11 AM

The document was copied with *.sxw extension from home directory..
as u said i saved it in *.rtf as well as *.doc extension..
the same problem persists..
The document is a source code in c..
is there any other way..:confused:

pixellany 11-13-2007 07:51 AM

In OpenOffice, are you using "save as" and then selecting--e.g.--MS Word 2000/XP? I ask this because you imply that you get the same results with the .sxw and .doc extensions. This would happen if you were simply changing the extensions.

Also, if the default extension is .sxw, it means you are using a fossil version of OOo---I suggest upgrading to 2.X

matthewg42 11-13-2007 08:23 AM

Why are you transferring C sourcecode as a word processing document? C is plain ASCII. All you need to do it change the end-of-line encoding and the file will be quite OK to open in notepad on Windows.

If you FTP the file between machines in ASCII mode, the end of line encoding will be changed automatically.

If you cannot use FTP for some reason, you can use a program like fromdos (and it's counterpart, todos), which you can run on the source file before copying it to the Windows machine.

peedaro 11-14-2007 09:26 AM

i hope i dont sound stupid..how do i actually change the end of line encoding...should i include it in my source code..??

matthewg42 11-18-2007 12:04 PM

The programs fromdos and todos convert files from and to the dos end-of-line encoding. For example:

You have your sourcecode file, maybe called myfile.c. You have edited it on your windows machine, maybe in notepad or Visual DevStudio or whatever... You want to transfer it to your Linux machine, so you burn a CD with the file on it.

On the destination machine (a Linux box), just install fromdos, and run it on the file after copying the file to your hard disk. It is a command line tool, so lets assume you have copied the file to your home directory... just open a terminal and use the command:
Code:

fromdos myfile.c
(Of course, you will need to have installed the fromdos program to do this).

That's it - the fromdos program modified the file so that it has unix-style line endings.

todos should be used if you edit the files on your unix box and burn a CD for transferring the files to Windows machine.

peedaro 11-20-2007 01:20 AM

Thanks A Lot..it Opened In Notepad...


All times are GMT -5. The time now is 08:47 AM.