jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1478799 - /jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/IRILib.java
Date Fri, 03 May 2013 14:07:57 GMT
Author: andy
Date: Fri May  3 14:07:56 2013
New Revision: 1478799

URL: http://svn.apache.org/r1478799
Log:
Don't encode ':' (Leave Windows drive marker alone)

Modified:
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/IRILib.java

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/IRILib.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/IRILib.java?rev=1478799&r1=1478798&r2=1478799&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/IRILib.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/system/IRILib.java Fri May  3 14:07:56
2013
@@ -28,42 +28,6 @@ import org.apache.jena.atlas.lib.StrUtil
 /** Operations related to IRIs */
 public class IRILib
 {
-    /** Encode using the rules for a component (e.g. ':' and '/' get encoded) 
-     * Does not encode non-ASCII characters 
-     */
-    public static String encodeUriComponent(String string)
-    {
-        String encStr = StrUtils.encodeHex(string,'%', charsComponent) ;
-        return encStr ;
-    }
-    
-    /** Encode using the rules for a file: URL.  Same as encodeUriPath except
-     * add "~" to the encoded set.
-     *  Does not encode non-ASCII characters
-     *   
-     */
-    public static String encodeFileURL(String string)
-    {
-        String encStr = StrUtils.encodeHex(string,'%', charsFilename) ;
-        return encStr ;
-    }
-    
-    /** Encode using the rules for a path (e.g. ':' and '/' do not get encoded) */
-    public static String encodeUriPath(String uri)
-    {
-        // Not perfect.
-        // Encode path.
-        // %-encode chars.
-        uri = StrUtils.encodeHex(uri, '%', charsPath) ;
-        return uri ;
-    }
-    
-    public static String decode(String string)
-    {
-        return StrUtils.decodeHex(string, '%') ;
-    }
-    
-    
     private static final boolean isWindows = (File.pathSeparatorChar == ';' ) ;
     // Does not help - we use file.getCanonicalPath
     // /*package*/ public static void setIsWindowsForTesting(boolean val) { isWindows = val
; }
@@ -100,7 +64,9 @@ public class IRILib
     
     private static char[] charsFilename =
         // reserved, + non-chars + nasties.
-        { '!', '*', '"', '\'', '(', ')', ';', ':', '@', '&', 
+        // Leave : (Windows drive charcater) and / (separator) alone
+        // include SPC and ~
+        { '!', '*', '"', '\'', '(', ')', ';', /*':',*/ '@', '&', 
           '=', '+', '$', ',', /*'/',*/ '?', '%', '#', '[', ']',
           '{', '}', '|', '\\', '`', '^',
           ' ', '<', '>', '\n', '\r', '\t',
@@ -224,6 +190,39 @@ public class IRILib
         return plainFilenameToURL(fn2) ;
     }
 
+    /** Encode using the rules for a component (e.g. ':' and '/' get encoded) 
+     * Does not encode non-ASCII characters 
+     */
+    public static String encodeUriComponent(String string)
+    {
+        String encStr = StrUtils.encodeHex(string,'%', charsComponent) ;
+        return encStr ;
+    }
+
+    /** Encode using the rules for a file: URL.  
+     *  Does not encode non-ASCII characters
+     */
+    public static String encodeFileURL(String string)
+    {
+        String encStr = StrUtils.encodeHex(string,'%', charsFilename) ;
+        return encStr ;
+    }
+
+    /** Encode using the rules for a path (e.g. ':' and '/' do not get encoded) */
+    public static String encodeUriPath(String uri)
+    {
+        // Not perfect.
+        // Encode path.
+        // %-encode chars.
+        uri = StrUtils.encodeHex(uri, '%', charsPath) ;
+        return uri ;
+    }
+
+    public static String decode(String string)
+    {
+        return StrUtils.decodeHex(string, '%') ;
+    }
+
     public static String encodeNonASCII(String string)
     {
         if ( ! containsNonASCII(string) )



Mime
View raw message