roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r574625 - /roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/URLUtilities.java
Date Tue, 11 Sep 2007 15:15:23 GMT
Author: snoopdave
Date: Tue Sep 11 08:15:22 2007
New Revision: 574625

URL: http://svn.apache.org/viewvc?rev=574625&view=rev
Log:
Fix for http://opensource.atlassian.com/projects/roller/browse/ROL-1542
"resource path in i18n directory or filename"

Tested with Chinese chars in directory name and in file name.

Modified:
    roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/URLUtilities.java

Modified: roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/URLUtilities.java
URL: http://svn.apache.org/viewvc/roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/URLUtilities.java?rev=574625&r1=574624&r2=574625&view=diff
==============================================================================
--- roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/URLUtilities.java
(original)
+++ roller/trunk/apps/weblogger/src/java/org/apache/roller/weblogger/util/URLUtilities.java
Tue Sep 11 08:15:22 2007
@@ -112,4 +112,22 @@
         }
         return tagsString.toString();
     }
+    
+        
+    /**
+     * URL encode a path string using UTF-8. The path seprator '/' will not be encoded
+     */
+    public static final String encodePath(String path) {
+        int i = path.indexOf('/');
+        StringBuffer sb = new StringBuffer();
+        while (i != -1) {
+            sb.append(encode(path.substring(0, i))).append('/');
+            path = path.substring(i + 1);
+            i = path.indexOf('/');
+        }
+        sb.append(encode(path));
+        return sb.toString();
+    }
 }
+
+



Mime
View raw message