Results 1 to 6 of 6

Thread: winsock html ascii extended

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2008
    Posts
    353

    winsock html ascii extended

    Hi,

    Im using this function to convert data before sending with winsock

    Code:
    Public Function URLEncode(ByVal Txt As String) As String
        Dim i      As Double
        Dim ch     As String
        Dim ch_asc As Integer
        Dim result As String
    
        SetSafeChars
    
        result = ""
    
        For i = 1 To Len(Txt)
            ' Translate the next character.
            ch = Mid$(Txt, i, 1)
            ch_asc = Asc(ch)
    
            If ch_asc = vbKeySpace Then
                ' Use a plus.
                result = result & "+"
            ElseIf m_SafeChar(ch_asc) Then
                ' Use the character.
                result = result & ch
            Else
                ' Convert the character to hex.
                result = result & "%" & Right$("0" & Hex$(ch_asc), 2)
            End If
    
        Next i
    
        URLEncode = result
    End Function
    If i use an ascii like █ winsock will send the data only till this char █...

    any ideas how to fix that?

    Cheers
    Thanks for helping me out.

  2. #2
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: winsock html ascii extended

    How do you know it's not sending ? maybe it is sending, but the text box (or whatever object you are using) does not display after it ?

    What is the code you use on the receiving side, and how to you display the text ?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2008
    Posts
    353

    Re: winsock html ascii extended

    yes you are correct, the RTF box is not accepting it...and before i send on winsock i have to convert to html with the code so it all gets sent..
    Im using this in the RTF box " ▄▄▄▓███▄▄ ▄▄██▓▄▄ ▄▄▄▓███▓▄ ▄▄▄▓████▄
    ▄▓████▀▀████▌▐██████▓▀▄▓████▀████▓▌ ▄▓████▀█████▓
    ▓████░▌ ▐██▓█▀ ▀█▌▀▀▀ ▓█████▌ ▐████▓ ▓█████▌ ▐█████"

    For this i get: ???? ???? ????


    hmmmm
    Thanks for helping me out.

  4. #4
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,802

    Re: winsock html ascii extended

    Well, show us the code you are using to send the data, and also to receive the data.

    Also, binary data cannot be displayed in text boxes or RTF, you should convert to HEX...

    And to send the binary data, the best way is to convert it to Base64, and convert back to binary on the receiving side.

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2008
    Posts
    353

    Re: winsock html ascii extended

    oki doki ...
    so i managed to load the data into TextBox ... not into RTF ... strange? hmmm

    what i did is change the font to Terminal...and i managed to load the file containing :
    ▄▄▓███▄▄ ▄▄██▓▄▄ ▄▄▄▓███▓▄ ▄▄▄▓████▄
    ▄▓████▀▀████▌▐██████▓▀▄▓████▀████▓▌ ▄▓████▀█████▓
    ▓████░▌ ▐██▓█▀ ▀█▌▀▀▀ ▓█████▌ ▐████▓ ▓█████▌ ▐█████"

    so what im doing next is sending the TextBox.Text into winsock.

    im only doing a send process within winsock...i do a POST command
    the text sends nicely..but at the the other end (webpage html) i get :

    ÛÛÛ± ßß Üß²Ý
    ÛÛÛÛÛ° ² ÜÛ²ÛÝ
    ÛÛÛÛÛÛÛ ²Ü ²Û²Û²
    ²Ü ÛÛÛÛÛÛÛ ° ²ßÜ ²Û°Û²°
    ²ßÜ °Û °ÛÛÛÛÛÛÛ Ý²² ²Û²Û² ° ÜÜ
    Û²ÛÜ ² ÛÛÛÛÛ ÛÛÛÛÛÛÛÛ Ü ²ÜÛ² Û²Û² ÜÜܲ²²ßß
    ²Û²Û² ܲ ÛÛÛÛÛ ÛÛÛÛ±±ÛÛÛÛ ²Ü ²ÜÛ²ÛÛßÜßß²Üßß
    ²Û°Û² Üß² ÛÛÛÛÛÛÛ ÛÛÛ±±±ÛÛÛÛ ß²²ÜßÛÛÛܲ


    im kinda lost now :S
    Thanks for helping me out.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2008
    Posts
    353

    Re: winsock html ascii extended

    any ideas what could i do to solve that?

    cheers
    Thanks for helping me out.

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