I have problem with this annoying ^M, while exporting some data, writing it to a CSV file to be downloaded. I did some research and found out that if the file you are reading comes from a Windows system this issue happens (Windows uses CR (i.e. ^M)/LF pair to indicate the end of a line, while UNIX uses only a LF).
Now can anyone offer me a solution to overcome this problem (like eliminating or replacing ^M ) before putting it to the writer (writer.write(columnToBeInserted);)