You sir are a genius! I would buy you a beer if you were in my timezone Great idea to look at the code.
I got it working.
I just needed to remove the UTF8 encoding.
So…
If you look at the docs here (https://capacitor.ionicframework.com/docs/apis/filesystem/#type-401)
It says that the encoding defaults to UTF8, so I didn’t think removing it would make any difference.
However looking at the code in the link you sent it defaults to plain text if you provide a value in encoding.
Charset charset = this.getEncoding(encoding);
...
// if charset is not null assume its a plain text file the user wants to save