problem saving with gEdit and then viewing with Notepad

By VicRic
Jul 21, 2007
  1. Hi. I'm using gEdit in both Fedora 6 and SUSE 10. I mostly use it to paste interesting text that I cut from web pages and then saving the text into a file.

    The problem is that when I save the text into a file I get the following default option:

    if I accept that and save and then move the file to a Windows machine and open it with Notepad then the text does not look as it should - you'd see all the text in one line, and the line breaks as the 'blank square' special character.

    Any idea on how can I solve this? I notice that Notepad saves its text into ANSI encoding, and gEdit only gives me options to save it in 'Current Locale UTF-8', 'Western ISO 8859-1', 'Western ISO 8859-15'. I don't see the option in gEdit to save the file in ANSI encoding, and I cannot 'Add' it.

  2. almcneil

    almcneil TS Guru Posts: 1,277

    Yeah, I know what this is.

    Basic ASCII-only text files use a special control character to mark the beginning of a newline, '\n' is the newline character. That program gEdit (I'm not familiar with it) isn't using that character to separate the lines, instead uses some other character code. That's why when you open it in Notepad, it displays it all on one line.

    You are correct, the file type encoding must match between text programs or else the text will appear messed up.
  3. VicRic

    VicRic TS Rookie Topic Starter Posts: 44

    Hey Al, I got advice on how to fix it.

    Using WordPad does solve the problem: you open the 'unix' file with WordPad and it's already readable. If you want to keep a converted copy then select in WordPad to save the file as type TextDocument-MSDOSFormat.

    Unix2dos also works; too bad it's a Terminal utility in Linux.
    I use it like this:
    $ unix2dos -n inputfile outputfile.txt
    and then move the file outputfile.txt to the Windows machine.

  4. almcneil

    almcneil TS Guru Posts: 1,277

    Yeah, I know unix2dos (or u2d) I used to be a high tech engineer. All that utility does is exactly what I explained above. It adds/removes the newline character, '\n'. That's all!
Topic Status:
Not open for further replies.

Similar Topics

Add your comment to this article

You need to be a member to leave a comment. Join thousands of tech enthusiasts and participate.
TechSpot Account You may also...