I have to print Chinese idioms via socket with ESC / POS , as examples
- Code: Select all Expand view
- #include "FiveWin.ch"
#include "hbsocket.ch"
#define ADDRESS "192.168.0.139"
#define PORT 9100
#define EOT ( Chr( 4 ) )
//----------------------------------------------------------------------------//
function Main()
local hSocket ,c1 := ''
FW_SetUnicode( .T. )
c1 := '"中国版"'
if empty( hSocket := hb_socketOpen() )
? "socket create error " + hb_ntos( hb_socketGetError() )
endif
if !hb_socketConnect( hSocket, { HB_SOCKET_AF_INET, hb_socketResolveAddr( ADDRESS ), PORT } )
? "socket connect error " + hb_ntos( hb_socketGetError() )
endif
MsgInfo(c1)
hb_socketSend( hSocket,c1 + chr(10)+chr(13))
hb_socketShutdown( hSocket )
hb_socketClose( hSocket )
return nil
the message on the screen is correct ,but the printed result is wrong (other idioms ) .
I compared with sockserv.prg (from fwh \ samples folder)
the transmission and reception of the program in FW and a program that correctly prints and analyzes the strings character by character with asc ()
this is the result :
Correct
---------------
214
208
185
250
176
230
With FW error
--------------------
228
184
173
229
155
189
231
137
136
I think you have to use a conversion program. Can someone help me ?
Maurizio