I am trying to read a txt file but the output starts with "" and all of the long dashes are replaced with "—". I wasn't able to find an adequate solution on Stack Overflow; all I know is that is has to do with ASCII characters and UTF-8 defaults. Any assistance in identifying and solving this problem would be greatly appreciated. Here's my code:
ifstream file("C:\\Users\\Jacob\\IdeaProjects\\Summary\\OED2(12-14).txt");
file.imbue(std::locale("en_US.UTF8"));
cout.imbue(std::locale("en_US.UTF8")); // maybe this as well?
I want to eventually pass the lines of the txt file through a lineSeparaterFunction, and the location of the long dash is where each line will be separated. But Visual Studio does not even recognize the mystery character, so I cant use it as a replacement.
I just want my string to be identical to the line in the txt file, is there no way to get Visual Studio to recognize the long dash? Do you think I should try and change the long dashes to something else in the txt file?

UTF-8 bytes: EF BB BF
ZERO WIDTH NO-BREAK SPACE
Hex code point: FEFF
ΓÇö
UTF-8 bytes: E2 80 94
EM DASH —
Hex code point: 2014
If these are the only two non-ascii characters in the text then it is by far the easiest to replace them with alternate characters.
You can replace the ZERO WIDTH NO-BREAK SPACE with a regular space.
As for the EM DASH, if a regular dash is not sufficient because other regular dashes exist in the text, then you could replace it with something that isn't in the text, perhaps a tilde (~) or perhaps two dashes in a row (--).