Various fixes to normal form handling in GVariant
See the commit messages for details.
This is an aggregation of three patch sets, from:
They have been reviewed under embargo by @dbnicholson, @mcatanzaro, and are based on an approach by @wmanley.
Closes #2121 (closed), #2540 (closed), #2794 (closed), #2797 (closed)