Fix copying of partial characters for UTF-8 input (libexpat bug 115):
https://github.com/libexpat/libexpat/issues/115
(cherry picked from commit 759e30ec47)
The standard header stdbool.h is not available
with old Visual Studio compilers
Cherry-picked from libexpat b4b89c2ab0cc5325a41360c25ef9d2ccbe617e5c.
expat: Add artificial scopes in xmltok.c utf8_toUtf8() to fix c89 compilation.
Cherry-picked from libexpat commit e0b290eb3d8f4c4b45137a7d7f4f8db812145bd2
with it a vareity of bug fixes, both security and behavior. See
http://www.libexpat.org/ for the list.
NOTE: I already backported the expat hash randomization fix in March.
Fixes issue #14340.