Fix integer handling when encoding configuration

This PR fixes #1812.  Includes API tests and integration tests for the regression.
Haha, but somebody might want to use: `☃=☮`