com.mindprod.csv
Class CSVStripEntities

java.lang.Object
  extended by com.mindprod.csv.CSVStripEntities

public final class CSVStripEntities
extends java.lang.Object

convert entities in selected columns back to UTF-8 characters.

Use: java.exe com.mindprod.CSVStripEntities somefile.csv 0 3

Since:
2011-01-24
Version:
1.1 2011-01-25 allow you to specify the encoding.
Author:
Roedy Green, Canadian Mind Products

Constructor Summary
CSVStripEntities(java.io.File file, char separatorChar, char quoteChar, char commentChar, java.lang.String encoding, int... colsToStrip)
          convert entities to UTF-8 in selected columns in a CSV file, constructor.
 
Method Summary
static void main(java.lang.String[] args)
          Simple command line interface to strip entities from selected columns in a CSV file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSVStripEntities

public CSVStripEntities(java.io.File file,
                        char separatorChar,
                        char quoteChar,
                        char commentChar,
                        java.lang.String encoding,
                        int... colsToStrip)
                 throws java.io.IOException
convert entities to UTF-8 in selected columns in a CSV file, constructor. Just create the CSVStripEntities object.. There are no methods to call.

Parameters:
file - CSV file to have entities stripped
separatorChar - field separator character, usually ',' in North America, ';' in Europe and sometimes '\t' for tab.
quoteChar - char to use to enclose fields containing a separator, usually '\"'. Use (char)0 if you don't want a quote character.
commentChar - char to use to introduce comments. Use (char) 0 if none. Only one character allowed.
encoding - encoding of the input and output file.
colsToStrip - list of columns wanted to have entities stripped.
Throws:
java.io.IOException - if problems reading/writing file
Method Detail

main

public static void main(java.lang.String[] args)
Simple command line interface to strip entities from selected columns in a CSV file. Must have extension .csv
Use java com.mindprod.CSVStripEntities somefile.csv 0 1 2 3 ... Output replaces input. If you want the input, make a copy first.

Parameters:
args - name of csv file to strip, followed by zero-based cols wanted in desired order.