Reputation: 49
i have a problem which i uploaded data using .CSV file format and it read by java class.and i would be store in db.upto now no problem,but when i read the data from db then data contains some special characters.
so please could you help me here
Thanks in advance.
Upvotes: 3
Views: 5778
Reputation: 68907
This is an article you should really read.
Next, to answer your question:
To Read a file encoded with UTF-8, use a BufferedReader
:
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));
To Write a file encoded with UTF-8 use a BufferedWriter
:
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
Make sure that the transmittion of the data through the sockets goes correct.
Upvotes: 0
Reputation: 533880
ASCII-7 is compatible with UTF-8. There is nothing you need to do turn turn ASCII-7 into UTF-8 (but it doesn't work the other way)
Upvotes: 4