How should a string be converted to a number for use by a hash function?
The input format of the data doesn't affect the security of the algorithm. 

Any format that can be represented by a sequence of bits will be fine. You can use raw ASCII byte values, 6-bit Base64 values, anything which is in binary form.

If you convert your string into ASCII bytes, for example, you'll end up with a set of 8 bit numbers. Join them together and there's your input.

Since SHA256 uses 32-bit words, it's common to use a byte format for the data (4 bytes = 32 bits). After converting your input to a set of bits, your first task will be to append a 1 bit, pad with zeroes to 448 bits and then append a 64-bit length (the original bit length of the input data) to give you a 512 bit buffer.

I'm sure you can handle the rest.