Info Posted May 20, 2011 Share Posted May 20, 2011 (edited) I'm trying to send Hebrew characters in TCP and then add the data to a tree view.server:expandcollapse popupTCPStartup() $listen = TCPListen(@IPAddress1,2000) GUICreate("") $tree = GUICtrlCreateTreeView(0, 0, 300, 300) GUISetState() While 1 $accept = TCPAccept($listen) If $accept <> -1 Then ExitLoop EndIf If GUIGetMsg() = -3 Then Exit EndIf WEnd ToolTip("accepted") While 1 $tcpRecv = TCPRecv($accept, 1000000,1) If $tcpRecv <> "" Then ExitLoop EndIf If GUIGetMsg() = -3 Then Exit EndIf WEnd ToolTip("received") GUICtrlCreateTreeViewItem("1: " & BinaryToString($tcpRecv,1),$tree) GUICtrlCreateTreeViewItem("2: " & BinaryToString($tcpRecv,2),$tree) GUICtrlCreateTreeViewItem("3: " & BinaryToString($tcpRecv,3),$tree) GUICtrlCreateTreeViewItem("4: " & BinaryToString($tcpRecv,4),$tree) GUICtrlCreateTreeViewItem("עברית: שדגשדג",$tree) ;just to see if Hebrew characters actually display TCPCloseSocket($accept) While 1 If GUIGetMsg() = -3 Then Exit EndIf WEnd TCPShutdown()client:TCPStartup() $con = TCPConnect(@IPAddress1,2000) If @error Then MsgBox(0,0,"could not connect") Exit EndIf TCPSend($con,Binary("א ב ג ד ה ו א ב ג ד ה ו")) ;TCPSend($con,Binary("asdasd")) Sleep(100) TCPShutdown()Result:Any suggestions? Edited May 20, 2011 by Info Link to comment Share on other sites More sharing options...
smartee Posted May 20, 2011 Share Posted May 20, 2011 hi info, When sending the data, use StringToBinary("your Hebrew chars",4) ;to encode as UTF8 and when receiving use BinaryToString($bPacket,4) ;to decode as UTF8 Hope this helps -smartee Link to comment Share on other sites More sharing options...
Info Posted May 20, 2011 Author Share Posted May 20, 2011 Works! thanks!! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now