https://issues.apache.org/ooo/show_bug.cgi?id=120273
--- Comment #6 from Ariel Constenla-Haile <[email protected]> --- (In reply to comment #4) > My question is that how can I convert "file:///d:/convert/h%e%l%l%o.odt" > into "file:///D:/convert /h%25e%25l%25l%25o.odt". I have hundreds of files > which hold "%" in the name. It is impossible for me to correct the name > manually one by one. Any suggestion? Thanks! You can use http://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/XFileIdentifierConverter.html#getFileURLFromSystemPath public static String convertToURL( XComponentContext xContext, String sBase, String sSystemPath) { String sURL = null; try { com.sun.star.ucb.XFileIdentifierConverter xFileConverter = (com.sun.star.ucb.XFileIdentifierConverter) UnoRuntime.queryInterface( com.sun.star.ucb.XFileIdentifierConverter.class, xContext.getServiceManager().createInstanceWithContext( "com.sun.star.ucb.FileContentProvider", xContext)); sURL = xFileConverter.getFileURLFromSystemPath( sBase, sSystemPath); } catch (java.lang.Exception e) { e.printStackTrace(); } finally { return sURL; } } Usage: String sURL = convertToURL(xContext, "", "D:\convert\h%25e%25l%25l%25o.odt"); -- You are receiving this mail because: You are the assignee for the bug.
