d7c9a31b4b
Sometimes Windows sends strings with excess null terminating bytes. For example, when one copies digits from calc.exe. At the same time, some local applications freak out when they encounter null bytes (at least LibreOffice is known to be replacing them with '#'). According to the specification of UTF8_STRING format [1], the string data must not contain any trailing null bytes. So they all should be trimmed, not only the last one. Also, if the trailing null byte is not present, the length should not be adjusted. For example, Firefox is actually sending "HTML Format" without a null byte while Internet Explorer adds one. The spec for text/html format [2] says nothing about the teminating null byte, so we are free to remove it, but at least we should not mistakingly delete '>' character of "</html>" tag when it is the last character. [1] http://www.pps.univ-paris-diderot.fr/~jch/software/UTF8_STRING/UTF8_STRING.text [2] https://www.ietf.org/rfc/rfc2854.txt |
||
---|---|---|
.. | ||
Android | ||
common | ||
DirectFB | ||
iOS | ||
Mac | ||
Sample | ||
Wayland | ||
Windows | ||
X11 | ||
.gitignore | ||
CMakeLists.txt |