Results 1 to 6 of 6

Thread: Saving Textbox In ANSI Format?

  1. #1
    Guest

    Lightbulb

    To let you know I am creating a text editor for perl and if you save the text using standard way of doing it the text is saved in a strange format. All the line feeds are converted into these little squares..(no idea what there called)but anyways I want to be able to save the textbox in ANSI format like how http://www.textpad.com lets you save it in ANSI format. Thats what I use right now but I want to have the specialized features of my program to do it. So anyways as I was saying I want the text to be saved in ANSI format. I'm sure this is not to hard. If anyone can help I would appreciate it.

  2. #2
    Guest
    Try this:

    Code:
    Dim sText As String
    Dim nFreeF As Integer
    
    sText = Text1.Text
    nFreeF = FreeFile
    
    Open MyFile$ For Output As nFreeF
       Print #nFreeF, sText
    Close
    I didn't test it yet, but I think it should work.

  3. #3
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    It's nothing to do with ASCII or Unicode problems.

    Under POSIX systems, lines are terminated with an "\n". Windows and DOS use "\r\n". So, when Windows encounters the POSIX style of line termination, it doesn't know what to do, so it puts a square up. Simply terminate your lines with vbCrLf to let it work on Windows. However, Perl scrips will usually run on some POSIX-based server, so it is best to have the option to save with only "\n", so that they work properly.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  4. #4
    Guest
    Well I have been doing some testing and it seems that I can everythign works fine in vb. The reason I asked this is because if you save a cgi script in notepad and reopen it the cgi script is corrupt to a perl engine. It wont even read it. But it seems in visual basic saving the text in something like the above example works fine. Havent tested it a perl engine can read it tho but I see no reason why it cant right now. No visible corruption..

  5. #5
    Fanatic Member
    Join Date
    Jul 2000
    Location
    Manchester NH
    Posts
    833
    When I write perl scripts and send them off to my UNIX based server I need to run a FIX command and then a CHMOD 775 to the file
    Kurt Simons
    [I know I'm a hack but my clients don't!]

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Yes, the FIX command rewrites the line endings.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

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



Click Here to Expand Forum to Full Width