我在SVN的存储库中有文件夹,其名称中包含一个en-dash(“\ u2013”) 。 我首先调用“svn list”(以我的Windows 7 + UTF-8编码)来获取目录列表。 在调用BufferedReader readLine()之后,它读取列表的文本。 正在显示的文件夹的名称包含连字符(“\ u002D”)而不是连字符(“\ u2013”)。BufferedReader方法ReadLine()将en-dash(“ u2013”)转换为连字符(“ u002D”)
对此有任何限制吗?
class Test {
public static void main(String args[]) {
BufferedReader br = null;
try {
String sCurrentLine;
br = new BufferedReader(new FileReader("C:\\test–ing.xml"));
System.out.println(br.readLine());
while ((sCurrentLine = br.readLine()) != null) {
System.out.println(sCurrentLine);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (br != null)
br.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
} // end main
您可能想要发布一些代码。我不清楚svn命令和Java程序是如何协同工作以及如何创建'BufferedReader'实例的。 – Codo
你可以试试这个: 类测试{ \t公共静态无效的主要(字符串ARGS []){ \t \t的BufferedReader BR = NULL; \t \t尝试{ \t \t \t字符串sCurrentLine; \t \t \t br = new BufferedReader(new FileReader(“C:\\ test-ing.xml”)); \t \t \t System.out.println(br.readLine()); \t \t \t而((sCurrentLine = br.readLine())!= NULL){ \t \t \t \t的System.out.println(sCurrentLine); \t \t \t} \t \t}赶上(IOException的发送){ \t \t \t e.printStackTrace(); \t \t} {终于 \t \t \t尝试{ \t \t \t \t如果(BR!= NULL) \t \t \t \t \t BR。关(); \t \t \t}赶上(IOException异常前){ \t \t \t \t ex.printStackTrace(); \t \t \t} \t \t} \t} //结束主 –
我加你的代码的问题。但我仍然不明白它与svn命令的关系。 – Codo