Fix discrepency between C/Python write_int.
Test to ensure int encodings match