Move integer check into qs_encode()