Another question doesn`t respond issue with object generated out of XML out of external system, where there is not a possibility to add quotes, backslashes or any other text.
I have got script:
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
public class test {
public static void main(String[] args){
try {
File fileDir = new File("c:\\java2\\test.csv");
Writer out = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(fileDir), "UTF8"));
out.append('\ufeff');
out.append("Webňite, UTF-8").append(",");
out.append("?? UTF-8");
out.append(",");
out.append("??????? UTF-8").append("\r\n");
out.flush();
out.close();
}
catch (UnsupportedEncodingException e)
{
System.out.println(e.getMessage());
}
catch (IOException e)
{
System.out.println(e.getMessage());
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
}
I would need text "Webňite, UTF-8" to be written in one cell when converted into csv.
Is it possible please?
Currently out of 3 texts I got 4 cells in csv, and I would need 3.
I would need text which consist comma sign, to not be splitted by csv file into 2 cells.
(example script only for purpose of demonstration, at the end I have java object from XML which consist comma in it`s value and unwantedly is divided into 2 cells.
So I would need solution which would also work not for pure text within append but also for object.
Thank you