Results 1 to 7 of 7

Thread: program written in Text Edit (Mac) used in Ubuntu: wierd characters?

  1. #1
    Join Date
    Mar 2006
    Location
    GA USA
    Beans
    890
    Distro
    Ubuntu Studio 22.04 Jammy Jellyfish

    program written in Text Edit (Mac) used in Ubuntu: wierd characters?

    Hi Community:

    I wrote a computer program on a Mac laptop for a language called "R". It worked great... it gave correct answers. The editor I used on the Mac was "Text Edit."



    I'm trying to get that program to run on Ubuntu now. I'm using gedit to look at the program, and cut and paste segments of the program into the R command window.

    I've made no changes to the program...

    The program worked on the Mac but not on Ubuntu.



    There seems to be be invisible characters or some sort of difference between the way the Apple computer sees the file the code is in and how gedit sees the file.

    Can someone please advise me on how to get the format of the file the program is in in a format that Ubuntu likes?

    Thanks!
    Phil Smith
    Duluth, GA

  2. #2
    Join Date
    Apr 2009
    Location
    Texas
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: program written in Text Edit (Mac) used in Ubuntu: wierd characters?

    try using the "vi" editor. In terminal just use vi to open up your document.
    Ubuntu Christian Edition chat on irc at server: OFTC/channel: #ubuntuCE
    BootInfoScript DualBooting
    Grub Grub2 MBR/GRUB
    Boot Info Script courtesy of community member meierfra and ghulselmans

  3. #3
    Join Date
    May 2007
    Beans
    60

    Re: program written in Text Edit (Mac) used in Ubuntu: wierd characters?

    In any "file breaks when moved to new OS" problem my first suspect is line-ending conventions. Mac OS nominally uses the same end-of-line marker Linux does (the newline character, \n), but once upon a time Macs used the carriage return character (\r),and some programs still call that the "Mac line ending."

    This is something to look for, though not necessarily instructions on how to fix it (though stlsaint's suggestion of doing it through vi is good, I'm sure vi can change one kind of line ending into another even if I'm not enough of a vi user to know exactly how).

  4. #4
    Join Date
    Mar 2006
    Location
    GA USA
    Beans
    890
    Distro
    Ubuntu Studio 22.04 Jammy Jellyfish

    Re: program written in Text Edit (Mac) used in Ubuntu: wierd characters?

    Hi DougB and stlsaint:

    I haven't used vi in 20 years!

    I opened the file with vi. I didn't see any weird characters, although some of the line feeds were clearly in the wrong place.

    Any other suggestions?

    thanks,
    Phil

  5. #5
    Join Date
    May 2007
    Beans
    60

    Re: program written in Text Edit (Mac) used in Ubuntu: wierd characters?

    Quote Originally Posted by Phil Smith View Post
    I didn't see any weird characters, although some of the line feeds were clearly in the wrong place.
    What did you see? Your program except with some misplaced line breaks? Or something else? I think I need a more detailed understanding of the problem to make more suggestions....

  6. #6
    Join Date
    Jun 2011
    Location
    United Kingdom
    Beans
    Hidden!
    Distro
    Lubuntu Development Release

    Re: program written in Text Edit (Mac) used in Ubuntu: wierd characters?

    Have you compressed it in any way?

    I find that compressing python source in .zip format, bouncing it around the web a bit, then unzipping, removes the line indents (and thus it doesn't work!).

  7. #7
    Join Date
    Mar 2006
    Location
    GA USA
    Beans
    890
    Distro
    Ubuntu Studio 22.04 Jammy Jellyfish

    Wink Howto convert a mac text file format to ubuntu text file format

    Hi all:

    Many thanks for all who responded to my query.

    Because of the responses, I was able to formulate my problem better and find a solution by googling:

    "Howto convert a mac text file format to ubuntu text file format"

    I found an easy solution at:

    http://ubuntugenius.wordpress.com/20...uxunix-format/

    The solution is simple:



    1. open the file with gedit
    2. file > save as, and then
    3. in the line ending text box, choose the operating system you want your text file format to be converted to.


    For example, if you've got an apple text file and want to convert it to unix/linux, choose "unix/linux" in the line ending box.

    Very easy!

    My thanks to those who came to my rescue and contribute to Ubuntu!

    Sincerely,
    Phil Smith
    Duluth, GA

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •