Results 1 to 5 of 5

Thread: Unable to read vbLf and vbTab in POST request

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    3

    Question Unable to read vbLf and vbTab in POST request

    Hello All I'm afraid I'm in desperate need of help. I'm trying to understand why tabs and line feeds aren't coming through a POST request. Here's the code to reproduce:

    POST request:

    Code:
    str = "accountRequest=<NewUser>" & vbLf & _
    "Hello" & vbTab & "World" & vbLf & _
    "</NewUser>"
    
    
    Set objHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0")
    objHTTP.open "POST", "service.asp", False 
    objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    objHTTP.send str
    
    response.Write(objHTTP.responseText)
    
    Set objHTTP = Nothing
    service.asp:

    Code:
    function w (str)
    response.Write(str & "<br>")
    end function
    
    str = request.Form("accountRequest")
    
    w(str)
    w("Tabs: "& InStr(str,vbTab))
    w("Lines: "& InStr(str,vbLf))
    output:

    Code:
    HelloWorld
    Tabs: 0
    Lines: 0

  2. #2
    Addicted Member
    Join Date
    Jul 2009
    Posts
    208

    Re: Unable to read vbLf and vbTab in POST request

    Untested, but try specifying the charset as well:
    Code:
    objHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    3

    Re: Unable to read vbLf and vbTab in POST request

    It didn't work. I also tried specifying the charset in the response as well without luck.

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Unable to read vbLf and vbTab in POST request

    ummm.... because it wasn't htmlencoded/urlencoded properly?

    just a guess.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2012
    Posts
    3

    Re: Unable to read vbLf and vbTab in POST request

    tg, you're right. In fact, it wasn't url encoded at all. I finally figured out that it doesn't matter if you do a $_POST in php which preserves the tab (\t). ASP's request method doesn't do it.

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