public static void saveToFile(CustomTestStep customStep, IFile file) { String xml = new CubicTestXStream().toXML(customStep); try { String charset = TestPersistance.getCharset(file.getLocation().toFile()); String charsetHeader = TestPersistance.getCharsetHeader(charset); xml = charsetHeader + "\n" + xml; FileUtils.writeStringToFile(file.getLocation().toFile(), xml, charset); } catch (IOException e) { ErrorHandler.logAndRethrow(e); } }