Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First you need to know what encoding your file is in, such as UTF-8 or UTF-16. What's generating this file to start with? </p> <p>After that, it's relatively straightforward - you need to create a <code>FileInputStream</code> wrapped in an <code>InputStreamReader</code> instead of just a <code>FileReader</code>. (<code>FileReader</code> always uses the default encoding for the system.) Specify the encoding to use when you create the <code>InputStreamReader</code>, and if you've picked the right one, everything should start working.</p> <p>Note that you don't need to use OpenCSV to check this - you could just read the text of the file yourself and print it all out. I'm not sure I'd trust <code>System.out</code> to be able to handle non-ASCII characters though - you may want to find a different way of examining strings, such as printing out the individual values of characters as integers (preferably in hex) and then comparing them with the <a href="http://unicode.org/charts" rel="noreferrer">charts at unicode.org</a>. On the other hand, you could try the right encoding and see what happens to start with...</p> <p>EDIT: Okay, so if you're using UTF-8:</p> <pre><code>CSVReader reader=new CSVReader( new InputStreamReader(new FileInputStream("d:\\a.csv"), "UTF-8"), ',', '\'', 1); String[] line; while ((line = reader.readNext()) != null) { StringBuilder stb = new StringBuilder(400); for (int i = 0; i &lt; line.length; i++) { stb.append(line[i]); stb.append(";"); } System.out.println(stb); } </code></pre> <p>(I hope you have a try/finally block to close the file in your real code.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload