Index: core/src/main/java/com/xpn/xwiki/plugin/packaging/PackageAPI.java
===================================================================
--- core/src/main/java/com/xpn/xwiki/plugin/packaging/PackageAPI.java	(révision 2581)
+++ core/src/main/java/com/xpn/xwiki/plugin/packaging/PackageAPI.java	(copie de travail)
@@ -158,7 +158,7 @@
 
     public String export() throws IOException, XWikiException {
         getXWikiContext().getResponse().setContentType("application/zip");
-        getXWikiContext().getResponse().addHeader("Content-disposition", "attachment; filename=" + XWiki.getURLEncoded(plugin.getName()) + ".xar");
+        getXWikiContext().getResponse().addHeader("Content-disposition", "attachment; filename=" + getXWikiContext().getWiki().getURLEncoded(plugin.getName()) + ".xar");
         getXWikiContext().setFinished(true);
         return  plugin.export(getXWikiContext().getResponse().getOutputStream(), getXWikiContext());
     }
Index: core/src/main/java/com/xpn/xwiki/api/XWiki.java
===================================================================
--- core/src/main/java/com/xpn/xwiki/api/XWiki.java	(révision 2581)
+++ core/src/main/java/com/xpn/xwiki/api/XWiki.java	(copie de travail)
@@ -209,7 +209,7 @@
 
     public String getURLEncoded(String content)
     {
-        return com.xpn.xwiki.XWiki.getURLEncoded(content);
+        return xwiki.getURLEncoded(content);
     }
 
     /**
Index: core/src/main/java/com/xpn/xwiki/XWiki.java
===================================================================
--- core/src/main/java/com/xpn/xwiki/XWiki.java	(révision 2581)
+++ core/src/main/java/com/xpn/xwiki/XWiki.java	(copie de travail)
@@ -1049,10 +1049,10 @@
         return scontent;
     }
 
-    public static String getURLEncoded(String content)
+    public String getURLEncoded(String content)
     {
         try {
-            return URLEncoder.encode(content, "UTF-8");
+            return URLEncoder.encode(content, this.getEncoding());
         } catch (UnsupportedEncodingException e) {
             return content;
         }
@@ -3667,12 +3667,26 @@
             if ((request.getParameter("topic") != null)
                 && (action.equals("edit") || action.equals("inline")))
                 docname = request.getParameter("topic");
-            else
-                docname = getDocumentNameFromPath(request.getPathInfo(), context);
+            else {
+                docname = getDocumentNameFromPath(fixDecodedURI(request, request.getPathInfo()), context);
+            }
         }
         return docname;
     }
 
+    private String fixDecodedURI(XWikiRequest request, String uri) {
+        // PATCH: tomcat does not properly handle URIs with non iso characters.
+        if (!request.getCharacterEncoding().equals("ISO-8859-1")) {
+            try {
+                byte[] urib = uri.getBytes("ISO-8859-1");
+                return new String(urib, getConfig().getProperty("xwiki.encoding", "UTF-8"));
+            } catch (UnsupportedEncodingException e) {
+                log.error("Unsupported Encoding Exception received, check your xwiki config.", e);
+            }
+        }
+         return uri;
+    }
+
     public boolean prepareDocuments(XWikiRequest request, XWikiContext context,
         VelocityContext vcontext) throws XWikiException
     {
Index: core/src/main/java/com/xpn/xwiki/util/TOCGenerator.java
===================================================================
--- core/src/main/java/com/xpn/xwiki/util/TOCGenerator.java	(révision 2581)
+++ core/src/main/java/com/xpn/xwiki/util/TOCGenerator.java	(copie de travail)
@@ -109,7 +109,7 @@
   public static String makeHeadingID (String text, int occurence, XWikiContext context) {
     // Encode to convert unsafe chars
     //text = Utils.encode(text.trim(), context);
-    text = "H" + XWiki.getURLEncoded(text);
+    text = "H" + context.getWiki().getURLEncoded(text);
     text = text.replaceAll("[^a-zA-Z0-9]", "");
         
     if (occurence > 0) {
Index: core/src/main/java/com/xpn/xwiki/web/DownloadAction.java
===================================================================
--- core/src/main/java/com/xpn/xwiki/web/DownloadAction.java	(révision 2581)
+++ core/src/main/java/com/xpn/xwiki/web/DownloadAction.java	(copie de travail)
@@ -72,7 +72,7 @@
         String mimetype = attachment.getMimeType(context);
         response.setContentType(mimetype);
 
-        String ofilename = XWiki.getURLEncoded(attachment.getFilename()).replaceAll("\\+", " ");
+        String ofilename = context.getWiki().getURLEncoded(attachment.getFilename()).replaceAll("\\+", " ");
 
         // The inline attribute of Content-Disposition tells the browser that they should display
         // the downloaded file in the page (see http://www.ietf.org/rfc/rfc1806.txt for more
Index: web/standard/src/main/webapp/skins/albatross/login.vm
===================================================================
--- web/standard/src/main/webapp/skins/albatross/login.vm	(révision 2581)
+++ web/standard/src/main/webapp/skins/albatross/login.vm	(copie de travail)
@@ -8,7 +8,7 @@
 #set($qs = "")
 #set($qs = $request.queryString)
 #if(!$request.getParameter("xredirect"))
-#set($qs = "xredirect=$doc.getURL('view')&${qs}")
+#set($qs = "xredirect=$xwiki.getURLEncoded($doc.getURL('view'))&${qs}")
 #end
 $response.sendRedirect($xwiki.getURL("XWiki.XWikiLogin", "login", $qs))
 #else
Index: web/standard/src/main/webapp/skins/albatross/global.vm
===================================================================
--- web/standard/src/main/webapp/skins/albatross/global.vm	(révision 2581)
+++ web/standard/src/main/webapp/skins/albatross/global.vm	(copie de travail)
@@ -36,10 +36,10 @@
 #end
 #if ($context.action != "loginerror")
 #if ($isguest)
-#set($loginurl = $xwiki.getURL("XWiki.XWikiLogin", "login", "xredirect=$logredir"))
+#set($loginurl = $xwiki.getURL("XWiki.XWikiLogin", "login", "xredirect=$xwiki.getURLEncoded($logredir)"))
       <a class="glink" href="$!loginurl" id="headerlogin">$!msg.get("login")</a>#sep()
 #else
-#set($logouturl = $xwiki.getURL("XWiki.XWikiLogout","logout", "xredirect=$logredir"))
+#set($logouturl = $xwiki.getURL("XWiki.XWikiLogout","logout", "xredirect=$xwiki.getURLEncoded($logredir)"))
       <a class="glink" href="$!logouturl" id="headerlogout">$!msg.get("logout")</a>#sep()
 #end
 #end
Index: web/standard/src/main/webapp/skins/albatross/create.vm
===================================================================
--- web/standard/src/main/webapp/skins/albatross/create.vm	(révision 2581)
+++ web/standard/src/main/webapp/skins/albatross/create.vm	(copie de travail)
@@ -48,9 +48,13 @@
 ##$newdoc.getURL("edit", "template=${template}&parent=${parent}$auxparams"))
 #if($newdoc.isNew())
 #if($tocreate == "post")
-$response.sendRedirect($newdoc.getURL("inline", "parent=Blog.WebHome&template=XWiki.ArticleClassTemplate&XWiki.ArticleClass_0_title=$title"))
+#set($etitle = $xwiki.getURLEncoded($title))
+$response.sendRedirect($newdoc.getURL("inline", "parent=Blog.WebHome&template=XWiki.ArticleClassTemplate&XWiki.ArticleClass_0_title=$etitle"))
 #else
-$response.sendRedirect($newdoc.getURL("edit", "template=${template}&parent=${parent}${auxparams}&title=$title"))
+#set($etitle = $xwiki.getURLEncoded($title))
+#set($etemplate = $xwiki.getURLEncoded("${template}"))
+#set($eparent = $xwiki.getURLEncoded("${parent}${auxparams}"))
+$response.sendRedirect($newdoc.getURL("edit", "template=${etemplate}&parent=${eparent}&title=$etitle"))
 #end
 #else
 $response.sendRedirect($newdoc.getURL("view", "xpage=docalreadyexists"))
