I actually recommend using modern cryptography like AES-CBC, but if you want to play with retro cryptography then lets have some fun here. Since your encryption output is text I might suggest the use of addition modulo rather than XOR. Only use XOR when working with bytes, not for characters. You'll need to avoid certain special characters in the output. In this case you appear to be having trouble with the NULL character. You could avoid output of characters by defining a character-set.
For example you might want to only use characters in the range of ASCII values 1 to 127 (all ASCII characters except NULL). That would mean that the base would be 1 and the modulus would be 126 = (127 - 1)
To encode a character, first subtract the base. Add the key value. Then, get the modulus result. Finally, add the base back in.
The decimal value of the lower case letter d is 100.
100 - 1 = 99 // subtract the base
99 + 904932 = 905031 // add the key value, used yours here
905031 % 126 = 99 // modulus result lol 904932 % 126 = 0
99 + 1 = 100 // add the base back in
Since your key value is divisible by the modulus 126 the output equals the input.
Undoing the addition modulo is a slightly different procedure.
100 - 1 = 99 // subtract the base
99 - 904932 = -904833 // subtract the key value
-904833 % 126 = -27 // modulus result
126 + -27 = 99 // add the modulus to the modulus result
99 + 1 = 100 // add the base back in
You can set the modulus as high as you want to include as many characters as you want into your character-set, and with some fancy math you can map characters to the integer values in any way.
While I do say that you can map the characters in any way you want the truth is that you're limited by the media that the text is written to. You can't set the modulus to be any higher than the total count of all characters that the media can carry, but you can have separate character mappings for encoded and decoded values.
I'll also comment on your key value selection. Applying the same key value to all characters is about the weakest possible form of encryption. (Can ROT13 really be considered encryption?) Think up some ways to vary the key value for each character. Somethings that were done when this type of crypto was in use was to increment the key by some value for each character, or to add the value of processed character to the key.