reihaneh
reihaneh

Reputation: 325

^M (ctrl+M) character is a part of string but java get end of line

i have a log file that each line is a row of database and i want insert it into database. in value of password field there is ^M (ctrl+M) character and it is not end of line but when java scanner arrive it take the remaining characters of the line new line how can i solve.note that it i need it and don't want to remove it

Upvotes: 0

Views: 965

Answers (1)

Zia
Zia

Reputation: 1011

Try to use BufferedReader with a FileReader instead of Scanner. or you can read the file with the respective encoding type i,e.

Scanner scanner = new Scanner(new File("LogFile.txt"), "utf-8");

Upvotes: 1

Related Questions