Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Text files rendering incorrectly in Notepad, fine in Wordpad

  • 08-08-2008 1:18pm
    #1
    Registered Users, Registered Users 2 Posts: 9,472 ✭✭✭


    I'm having some trouble with text files. I need to import around 4000 files into a program but they're all rendering incorrectly in Notepad and the program can't import the files.

    However, when I open the file in Wordpad, it renders fine and then when I simply save the file using Wordpad, the file is fine in Notepad and can be imported without a problem.

    I'm trying to figure out why they're being being rendered incorrectly in Notepad and how to fix it. Anyone have any ideas?

    FILES COMPARED


Comments

  • Registered Users, Registered Users 2 Posts: 14,012 ✭✭✭✭Cuddlesworth


    Yeah notepad is a very basic program text program, as basic as you can really get on Windows. For that reason it won't recognise most types of textual formatting. I don't think you can get what you want out of it.


  • Registered Users, Registered Users 2 Posts: 1,311 ✭✭✭Procasinator


    If I took a guess it would be line endings. There a couple different characters around dealing with a newline: carriage return (which I'll refer to as \r) and newline (Which I'll refer to as \n).

    Windows systems: \r\n
    Unix systems: \n
    Mac systems: \r

    Any bet the file you are reading originated from a unix-based system, or an editor which saved with only a \n character for each newline.

    You need \r\n for notepad to display new lines properly.


  • Registered Users, Registered Users 2 Posts: 1,311 ✭✭✭Procasinator


    The easiest way to fix it is to a mass replace of each \n character as \r\n.
    There is no command I can think of for a Windows machine to do this for you.

    Either right a program or look for one.


  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    If I took a guess it would be line endings. There a couple different characters around dealing with a newline: carriage return (which I'll refer to as \r) and newline (Which I'll refer to as \n).

    Windows systems: \r\n
    Unix systems: \n
    Mac systems: \r

    Any bet the file you are reading originated from a unix-based system, or an editor which saved with only a \n character for each newline.

    You need \r\n for notepad to display new lines properly.
    +1


  • Registered Users, Registered Users 2 Posts: 7,501 ✭✭✭BrokenArrows


    If I took a guess it would be line endings. There a couple different characters around dealing with a newline: carriage return (which I'll refer to as \r) and newline (Which I'll refer to as \n).

    Windows systems: \r\n
    Unix systems: \n
    Mac systems: \r

    Any bet the file you are reading originated from a unix-based system, or an editor which saved with only a \n character for each newline.

    You need \r\n for notepad to display new lines properly.

    what i was going to say. maybe not so clearly!


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 86,729 ✭✭✭✭Overheal


    Would a batch file be able to sort you out there? You could make a .bat to add the \n's that you need. Or a C++ program. I used to know how to do such things but its been a while. I remember it was relatively simple and probably less staggering than manually editing 4000 text files.


  • Registered Users, Registered Users 2 Posts: 9,957 ✭✭✭trout


    tofrodos is yore friend.

    Freeware utility to handle this very situation - accepts wildcards so no need for batch files.

    Take a copy of your files, and run this on a sample of them.
    There are two exes ... todos and fromdos ... I suspect you need todos.

    Good luck.

    http://www.thefreecountry.com/tofrodos/index.shtml


Advertisement