Strings are truncated if they contain '\0' character
std::string is technically not 0-terminated, and so you can construct valid std::strings with '\0' characters in them. This is especially useful because you can wrap raw binary data into an std::string and still cart it around properly.
The issue is that at the network level, the Sharing library uses .c_str() to put the std::string into a RakString before sending. RakString is a 0-terminated string, so it will truncate the std::string to the 0 terminator.
The fix is to not use RakString. There are plenty of solutions, but what I chose was to send a uint32 size, and then WriteAlignedBytes for the string data. Similarly, on the read side, instead of reading a RakString, I read the uint32 size and ReadAlignedBytes into an std::string.
I have written this and it works. I can go through the hassle of branching and doing a pull request, but this is simple enough that it seems it could be fixed on your end using your own style/preferences.
NOTE: The way I did this, it caused old servers to crash, so the server has to be replaced before using.
Would love to see the Pull Request from you for this!
https://github.com/Microsoft/HoloToolkit/pull/81