conversion unix dos text file or related problem??

Discussion in 'Programming' started by ycc, Apr 2, 2010.

  1. #1
    I manage my site from several different computers, among them Linux and Windows systems. I often use simple texteditors in Internetcafes.

    I often have to resort to Windows/Wordpad. Some of my files will not show linebreaks in Wordpad. (Linebreaks are OK in Notepad but Notepad is not useful for my purposes.)

    If I run Ultraedit it automatically asks "convert to dos format" which solves the problem. (But I do not have access to Ultraedit to convert all files now) Crimsoneditor shows correct linebreaks but does not convert.

    I thought it was a simple problem of different representations of new-line in Linux and Windows, but I do not think so any more.

    I have tried different "unix to windows" conversions programs without avail.

    Please tell me what is wrong with the attached file. How should I make it show linebreaks in Wordpad.

    Hopefully the solution is easily implemented in an Internetcafe.

    Thanks

    (The attached file is a javascript snippet, given txt extension to be able to upload it to this site)
     

    Attached Files:

    ycc, Apr 2, 2010 IP
  2. koko5

    koko5 Active Member

    Messages:
    394
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    70
    #2
    Hi, you can set new lines marker when you save the file.In mousepad point to File->Save As there is "Current Locale (UTF-8)" and new line: here you must choose CR+LF (carriage return + line feed, which is windows compatible).
    Regards :)
    Edit:With few words always set new line marker manually when you use Unix text editor to be windows cr+lf compatible.
     
    Last edited: Apr 2, 2010
    koko5, Apr 2, 2010 IP
  3. ycc

    ycc Peon

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks koko5. (Also thanks for your reply about mysql, in another thread.)

    So Mousepad will solve the problem. I think Mousepad is for Xfce in Linux.

    I forgot to say one important thing in my question. I now have to use Windows Internetcafes for some time and what I need is a program for the Windows platform that can set thet new-line characters right. (i have tried u2d and todos but they don't work, I cannot understand why. Only Ultraedit works.)

    Please tell me how to put new line characters into the attached file so that it is readable in Wordpad.

    Thanks.
     
    ycc, Apr 2, 2010 IP
  4. koko5

    koko5 Active Member

    Messages:
    394
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    70
    #4
    Hi @ycc,

    I'm not sure that the problem is in new lines. Maybe you have some not-latin characters in file, so Wordpad asks you to convert.
    When text file is saved in Unix default new line is CR ("\n"). In windows you'll see entire file as a single line.

    But when file is saved as not unicode file and there are not latin characters (even one), than wordpad may ask to convert.

    So, never mind windows or unix, best option is to use unicode file format (utf8) and windows cr+lf for new lines.
    A lot of people recommend Notepad++ as the best free windows editor-maybe it is installed in Internetcafes.
    I'm attaching your file with new line marker changed via mousepad. Please let me know did this solve the problem.
    Regards :)
    Edit:I've not windows computer right now here to test
     

    Attached Files:

    koko5, Apr 2, 2010 IP
  5. ycc

    ycc Peon

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks koko5.

    The result you produced is much better, it will put TWO new lines where there should be one. It may be a solution for me. I just tried the free editor ConTEXT in Windows and got the same result. After your suggestion I also used an old copy I have of Notepad++ with the same result. (I liked Np++ a lot some time ago but had to abandon it, I think there is a bug in its macro function.)

    I could probably remove the couble new lines with a macro.

    This is a way of doing it manually although I don't really understand what I am doing. I do not understand what you mean by "Wordpad asks to convert". I have not got any questions from Wordpad to convert.

    I thought the filiesize would double when you converted to unicode in Mousepad, but it is still the same.

    Thanks a lot for looking into it. I got good suggestions and I think there is no easy way. The new-line characters in my files are crazy and I will have to do every file for itself, hopefully being able to use a macro to reduce the double newlines to single new lines. (I cant make the search-reg-exp in my editors find the new lines. I thought \r\n or \n would do it)

    I just fear what will happen when I go to a Linux system and start editing. My server is also Linux. Hopefully nothing worse will come out than double new lines. (It is usually not too detrimental in javascript, css, php or HTML)

    Thanks
     
    ycc, Apr 2, 2010 IP