Jump to content
Sign in to follow this  

Http1.1 TCPRecv Unicode issue.

Recommended Posts

hey guys,

The thing is, i have a MySQL DB that contains all sorts of 'Text' data which is saved in a UTF-8 UNICODE format [in the DB] now all i want to do is pull that data out of the MySQL DB and 'Echo' it to autoit.

Now... there is no issue while 'Echo'ing it... it works just fine through a browser... i can switch that page's encoding into UTF-8 and it's all readable and fine...

however when i try pulling this page through AU3 it seems like the HTTP1.1 TCPRecv is failing...

i've also tried using:

htmlentities($OutPut, ENT_NOQUOTES, "UTF-8")

before the "php" echo but it yet seems to fail...

Any pointers?!


-> seems like there are issues always and only if the "Echo"ed string text is in fact UNICODED and not a simple eng text.

-> everything works fine as i go to that page through the browser... only Au3 is making trouble...

Share this post

Link to post
Share on other sites

The PHP part is working all ok i think [since it does spit the data into the browser when accessed by the browser] but i think that there is some issues with sending the data via HTTP1.1 to the AU3 script...

while i'm running TCPRecv on the script the script is waiting, waiting and then tells me that the server has timed out with only just a part of the package sent.... any idea?

please guys... anything to hold on to ?!

Share this post

Link to post
Share on other sites

I dont know if it can help you, but this script works for me:

#include <IE.au3>

$URL = StringSplit("www.yahoo.com","/")
$Path = "/"
For $i = 2 to $URL[0]
    $Path = $Path&$URL[$i]&"/"


Func Main()
    Local $IP = TCPNameToIP($URL[1])
    If @error Then
        ConsoleWrite("Error: Unable to resolve hostname" & @CRLF)
        Return -1

    Local $socket = TCPConnect($IP, 80)
    If @error Then
        ConsoleWrite("Error: Unable to open socket" & @CRLF)
        Return -2

    TCPSend($socket, "GET "&$Path&" HTTP/1.1" &@CRLF&"Host: "&$URL[1] & @LF & @LF)

    $File = FileOpen(@DesktopDir&"\Page.html",2)

    Local $sText
    Local $Total
    Local $Count = 300
    While 1
        $sText = TCPRecv($socket, 2048)

        If $sText = "" Then
            $Count -= 1
            if $Count = 0 Then ExitLoop
            $Total &= $sText
    $File = FileOpen(@DesktopDir&"\Page.html",1)
    $IE = _IECreate(@DesktopDir&"\Page.html")

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...