encode message to int