Page 1 of 1
[Implemented] SendNetworkString() UTF8
Posted: Tue Sep 02, 2008 1:51 pm
by Rescator
Fred, any chance you can change the current SendNetworkString() to behave similar to my SendNetworkStringUTF8() and add a ReceiveNetworkString() similar my ReceiveNetworkStringUTF8() ?
For details/implementation suggestion see:
http://www.purebasic.fr/english/viewtop ... 428#257428
The current one does not handle unicode, only ascii right? And considering that ascii is able to carry UTF8 a new SendNetworkString() will still remain backwards compatible with old/current ascii programs. As for old unicode programs...those are broken anyway with the old SendNetworkString()

Posted: Tue Sep 02, 2008 2:00 pm
by Rescator
Considering how robust this would be, might I also suggest a #PB_NetworkEvent_String=5

Posted: Tue Sep 02, 2008 9:13 pm
by dracflamloc
The string function was just a convenience function. You don't send 'strings' over the network, just bytes. You can send unicode string same way as normal strings, as sequences of bytes. ReceiveNetworkString would make no sense and there'd be no good way of knowing if the bytes being received were supposed to be a string, let alone what type of string.
Posted: Wed Sep 03, 2008 8:34 am
by Rescator
Did you see my example in the other thread?
All strings are treated as UTF8, 99% of all ascii will be accepted as-is by UTF8 so hardly an issue.
Also, there is a send/receive File currently.
I think that send/receive file, + send/receive data, + send/receive text, would be a nice trio of network functions, especially if strings are given a event flag. That way a game client/server can react to the event type. obviously a server in particular but a client as well should always check if the received data, whether it is data, a file or a string that is valid. But it does allow a virtual 3 channel data transfer. (raw data, file data, string data)
send/receivefile already uses a safe marker to indicate it's a file and not raw data, shouldn't be much harder to do the same with strings if the strings are made to be UTF8 which is platform and byteorder independent.
Posted: Fri Sep 05, 2008 5:06 pm
by dracflamloc
Well, I suppose since I was against SendNetworkFile as well...
If this is to be the path of the pb netlib I think a settable option should be allowed in initnetwork() to disable any receive events except data, to allow for more 'pure' use
Posted: Fri Sep 05, 2008 5:28 pm
by Rook Zimbabwe
Dang... I found this one and was gonna post it!

Thanks Rescator... thanks for the workaround as well!
Posted: Wed Sep 10, 2008 1:21 pm
by Rescator
Well! I guess you could still post a bug report. But I'm assuming the PB Team are well aware of this now
