I use the Apache Commons API to append a new line to a file using the FTPClient class. When I run the following code in Java, a new line is appended to the file on the FTP server. However, when I run the same code in Android, the String is appended to the file without a new line.
Why is the new line using - System.getProperty("line.separator") - not transferred via FTP under Android?
Also, the new line is correctly displayed in the LogCat but does not work in the txt file on the FTP server. Maybe there is a difference in character encoding between Java and Android?
Thank you very much.
String log = System.getProperty("line.separator") + "blablabla";
boolean done = ftpClient.appendFile("log.txt", new ByteArrayInputStream(log.getBytes("UTF-8")));
System.out.println("LOG: " + log);