Tag: urlencode文件

Java附带的Transformer库将文件路径中的空格转换为%20

这是一个写出XML文件的测试应用程序。 为什么路径中的空格被转换为%20 ? public class XmlTest { public static void main(String[] args) { String filename = “C:\\New Folder\\test.xml”; try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, “yes”); transformer.setOutputProperty(“{http://xml.apache.org/xslt}indent-amount”, “4”); DOMSource source = new DOMSource(doc); File xmlFile = new File(filename); if […]