String gets additional symbol at the end after reading CSV

I have a function that accepts std::iostream&, reads line from it with std::getline, puts in into std::stringstream and parses with std::getline with separator. I pass ifstream into this function and in the loop it parses entire csv. It works 100% fine with mvsc and mingw, x64 or x86, but here, for some reason, every line gets 1 additional symbol with code 13 at the end before ‘\0’. ASCII table says its “carriage return” symbol. However, it does not appear with any other compiler even when I am reading the same file with the same encoding standard. What could cause this problem?
Full code is probably too big for the forum and hopefully is not necessary

Hey @DeadM00n, welcome to the forums!

I’m not an expert on C++, but would this help?

No, its definitely is not a BOM. As I understand, it is a ‘\r’ symbol, it is used to move cursor to the start of a line. Of course, it shouldn’t be in the file, but here it caused weird behaviour. For example, this code with value = 11.00 from the file:

std::cout << "Double to check: \"" << value << "\"\n";

produced this output:

"ouble to check: "11.00

I downloaded the file from the site, just to double-check it, and my original code still works perfectly fine on my system, so the problem should be in the input system

1 Like

I recommend asking on the Replit Discord!

Different operating systems represent line endings in files slightly differently, some devices use \n, I believe some use \r and some use \r\n, so this might be to do with Replit’s virtual machines and what operating system they use.