Storing encrypted text

I have a password vault program that uses the XOR cipher below to store usernames and passwords in a text file. Each line contains one username and password pair, and they are delimited with a comma, so it follows this format:

username,password

username,password

etc.

The problem is that that the cipher will occasionally encrypt a character into a comma, so when I try to read the file again, the data will be read improperly and it will essentially be deleted.

I was thinking about solving this by checking to see if a comma results from the XOR cipher and if so, increment it to the next ascii character “-“, and then return it back to a comma when reading the data and decrypting it. The problem I see with this solution is that it can cause collisions with characters that get encrypted to a “-” right away.

Can anyone think of a solution to this that I can use to prevent data from being lost?

    // XOR cipher
    public static String encryptDecrypt(String input, String pass) {
         char[] key = pass.toCharArray();
         StringBuilder output = new StringBuilder();
         for (int i = 0; i < input.length(); i++) {
             output.append((char) (input.charAt(i) ^ key[i % key.length]));
         }
         return output.toString();
    }