I am wondering how to detect the character set of a file before I read it in using the FileReader Web API. I need to know what the file charset is before I read it in using fileReader.readAsText(file, "UTF-8") where "UTF-8" for me at the moment is unknown.
Is there any npm packages that I can use with Angular or any manual Vanilla way of detecting a character set without looking at the signatures or using a BOM code (files on my PC saved in either ISO-8859-1 or UTF-8 have same signature and no BOM code).
The packages I have tried to use so far are 'encoding', 'chardet' and 'encoding-japanese'. These don't work with Angular 8 as they are made for use with Node.
Back story: I have a CSV and as soon as it saves in Excel, it saves with the encoding of ISO-8859-1 and I cannot expect all my clients to save their files with a specific encoding (non-technically minded folk). However, other clients may use Notepad++ which will save these files in UTF-8. I need a way of determining the encoding used to stop characters like: "�" appearing.