dcsimg
Results 1 to 5 of 5

Thread: Character set difference? [RESOLVED]

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879

    Resolved Character set difference? [RESOLVED]

    Hey,

    I'm outputting a few lines from a PHP script. I use "\r\n" at the end of every line in order to start a new line. Now I want to parse the output line by line in a VB program, but for some reason, the \r\n is converted into character 32, which is a space.

    Any ideas on how to fix this?

    example:

    #PHP CODE
    echo "line 1\r\n";
    echo "line 2\r\n";

    #VB CODE
    MyArr = Split(HTML, vbCrLf)
    Msgbox MyArr(0) ' THIS RETURNS "line 1 line 2"

    What the hell is up with that?
    Last edited by VIP3R; Jul 8th, 2005 at 12:36 PM.
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


  2. #2
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Character set difference?

    can u upload a small part of the php file in its raw form?
    that will help so I (We) can play with it...
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879

    Re: Character set difference?

    Oh, the php file is as simple as
    echo "line 1\r\n";
    echo "line 2\r\n";
    echo "line 3\r\n";

    I figured out that if I use IE.Document.Body.InnerHTML, then the \r\n is converted into a space for some reason. However, if I use IE.Document.Body.OuterHTML then the \r\n becomes equivalent to vbCrLf but there's junk HTML to deal with :S.
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


  4. #4
    eltiT resU motsuC Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Character set difference?

    have you looked into URLDownloadToFile API?

    it works well without any Inet etc controls.. (At least for small files like a web page)
    you may be able to get it in its raw form then
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879

    Re: Character set difference?

    Oh yeah, I use the URLDownloadToFile api but the app is IE dependant. But I decided to change the method I'm using to output text into IE.
    Instead of:
    echo "line1\r\n";
    I did:
    echo "<tag>line1</tag>";

    and then I have some nice code to extract it from the HTML easily and accurately.
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width