how to represent message as an integer between $1$ and $n-1$ I am trying to implement simple El-Gamal cryptosystem.

And I can't understand how to represent message as an integer between $1$ and $n-1$.
The only thing that comes to my mind is:
 if $n$ bit length is $k$, then divide input message m on $t | t &lt; k$ bits and each piece of bits use as integer number.

I think It is wrong.

So how to represent message as an integer between $1$ and $n-1$?
How do you represent integers on a computer? In binary format:
$$71_{dec} = 100\,0111_{bin} $$

How do we represent letters on a computer? (Mostly) in ASCII format (and ASCII is in binary):
$$\text{A} = 100\,0001_{bin}$$

How do we represent more than one letter on a computer? We concatenate the seperate letters. We use blocks of 7 bits and not 8 bits to save space:
$$\text{Hello} = 100\,1000\,1100\,1011\,1011\,0011\,0110\,0110\,1111_{bin}$$

Now we can read this number as integer:
$$100\,1000\,1100\,1011\,1011\,0011\,0110\,0110\,1111_{bin} = 19540948591_{dec}$$

With this number we can use the normal El-Gamal algorithm. If the number is bigger than $n$, than we have to split the initial message into smaller parts. It doesn't matter how exactly you split it, but be sure that the decryptor knows how you did it so he or she can decrypt it again. Oh, but be warned: El-Gamal is not secure without additional security measures.