UnityWifiDirect icon indicating copy to clipboard operation
UnityWifiDirect copied to clipboard

onUglyTxtRecord not working properly

Open whiskeY11 opened this issue 6 years ago • 1 comments

Output from log:

11-05 23:42:04.554 16464 16464 I UnityWifiDirect: device found with text record, formatted string: /v8AMABlADoAOQA2ADoAYgBmADoAZQAzADoANQBhADoAZQA4 11-05 23:42:04.554 16464 16464 I UnityWifiDirect: _/v8AZABlAG0Abw== 11-05 23:42:04.554 16464 16464 I UnityWifiDirect: ?/v8AdQBuAGkAdAB5 11-05 23:42:04.554 16464 16464 I UnityWifiDirect: _ 11-05 23:42:04.555 16464 16464 I UnityWifiDirect: device found @ address 0e:96:bf:e3:5a:e8 11-05 23:42:04.596 16464 16488 I Unity : ´┐żŠÉÇŠöÇŠ┤ÇŠ╝Ç value: ´┐żšöÇŠŞÇŠĄÇšÉÇšĄÇ

Last line shows encoded txt record where the first value is the key (´┐żŠÉÇŠöÇŠ┤ÇŠ╝Ç) and second is the value. I'm pretty sure this is not how its supposed to be, but I cannot get it to work properly. Any ideas of what might be wrong?

//Edit : after modifying the plugin to show more logs I managed to get these: 11-05 23:59:59.335 17106 17106 I UnityWifiDirect: txt-rec addr: 0e:96:bf:e3:5a:e8 11-05 23:59:59.335 17106 17106 I UnityWifiDirect: txt-rec key: demo 11-05 23:59:59.335 17106 17106 I UnityWifiDirect: txt-rec value: unity

So the problem is clearly bad encoding.

whiskeY11 avatar Nov 05 '19 22:11 whiskeY11

For anyone who comes across this issue in the future...

As you can see from the logs, the different components are logged in seperate lines, indicating the string contains CR after each string component, which are not taken into account in the decoding process. So this issue can be easily solved by removing CR from the original string, before processing through the decoder in onUglyTxtRecord method of WifiDirectBase.cs.

uglyRecord = uglyRecord.Replace("\n", "");

Enozone3D avatar Aug 27 '20 10:08 Enozone3D