191368 Policy URL in preferences doesn't support UTF-8 characters
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/URLEncoder.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/URLEncoder.java
index 0591b7d..8b70857 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/URLEncoder.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/URLEncoder.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * Copyright (c) 2000, 2007 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     James D Miles (IBM Corp.) - bug 191368, Policy URL doesn't support UTF-8 characters
  *******************************************************************************/
 package org.eclipse.update.internal.core;
 
@@ -82,12 +83,13 @@
 		String auth = url.getAuthority();
 		String host = url.getHost();
 		int port = url.getPort();
+		String userinfo = url.getUserInfo();
 
 		// do not encode if there is an authority, such as in
 		// ftp://user:password@host:port/path 
 		// because the URL constructor does not allow it
 		URL result = url;
-		if (auth == null || auth.equals("") || auth.equals(host+":"+ port)) // $NON-NLS-1$ $NON-NLS-2$  //$NON-NLS-1$//$NON-NLS-2$
+		if (auth == null || auth.equals("") || userinfo == null) // $NON-NLS-1$ $NON-NLS-2$  //$NON-NLS-1$//$NON-NLS-2$
 			result =  new URL(url.getProtocol(), host, port, encode(file, query, ref));
 		return result;
 	}
@@ -119,6 +121,7 @@
 
 		return result.toString();
 	}
+	
 	private static boolean mustEncode(char c) {
 		if (c >= 'a' && c <= 'z') {
 			return false;
@@ -136,7 +139,7 @@
 			return false;
 		}
 
-		if (c == '!' || c == '$' || c == '_') {
+		if (c == '!' || c == '$' || c == '_' || c == '[' || c == ']') {
 			return false;
 		}
 
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/operations/UpdateUtils.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/operations/UpdateUtils.java
index 0697f7a..2680dff 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/operations/UpdateUtils.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/operations/UpdateUtils.java
@@ -7,10 +7,10 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     James D Miles (IBM Corp.) - bug 191368, Policy URL doesn't support UTF-8 characters
  *******************************************************************************/
 package org.eclipse.update.internal.operations;
 
-import java.io.*;
 import java.lang.reflect.*;
 import java.net.*;
 import java.util.ArrayList;
@@ -20,8 +20,8 @@
 import org.eclipse.update.configuration.*;
 import org.eclipse.update.core.*;
 import org.eclipse.update.core.model.*;
-import org.eclipse.update.internal.configurator.UpdateURLDecoder;
 import org.eclipse.update.internal.core.*;
+import org.eclipse.update.internal.core.URLEncoder;
 import org.eclipse.update.internal.search.*;
 import org.eclipse.update.operations.*;
 import org.eclipse.update.search.*;
@@ -514,13 +514,12 @@
 		String mapFile = pref.getString(UpdateUtils.P_UPDATE_POLICY_URL);
 		if (mapFile!=null && mapFile.length()>0) {
 			try {
-				//PAL foundation
-				String decodedFile = UpdateURLDecoder.decode(mapFile, "UTF-8"); //$NON-NLS-1$
-				return new URL(decodedFile);
+				URL url = new URL(mapFile);
+				URL resolvedURL = URLEncoder.encode(url);
+				return resolvedURL;
 			}
 			catch (MalformedURLException e) {
-			}
-			catch(UnsupportedEncodingException e) {
+				UpdateUtils.logException(e);
 			}
 		}
 		return null;
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/search/UpdatePolicy.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/search/UpdatePolicy.java
index 2dc811f..6e62a86 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/search/UpdatePolicy.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/search/UpdatePolicy.java
@@ -7,12 +7,12 @@
  *
  * Contributors:
  *     IBM Corporation - initial API and implementation
+ *     James D Miles (IBM Corp.) - bug 191368, Policy URL doesn't support UTF-8 characters
  *******************************************************************************/
 package org.eclipse.update.internal.search;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -26,8 +26,8 @@
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.update.core.ISite;
 import org.eclipse.update.core.Utilities;
-import org.eclipse.update.internal.configurator.UpdateURLDecoder;
 import org.eclipse.update.internal.core.Messages;
+import org.eclipse.update.internal.core.URLEncoder;
 import org.eclipse.update.internal.core.UpdateManagerUtils;
 import org.eclipse.update.internal.core.connection.ConnectionFactory;
 import org.eclipse.update.internal.core.connection.IResponse;
@@ -263,14 +263,12 @@
 		}
 
 		try {
-			//PAL foundation
-			String decodedValue = UpdateURLDecoder.decode(urlName, "UTF-8"); //$NON-NLS-1$
-			URL url = new URL(decodedValue);
-			addUpdateEntry(pattern, url, type);
+			URL url = new URL(urlName);
+			URL resolvedURL = URLEncoder.encode(url);
+			addUpdateEntry(pattern, resolvedURL, type);
 		} catch (MalformedURLException e) {
 			throwCoreException(Messages.UpdatePolicy_invalidURL+urlName, null); 
-		} catch (UnsupportedEncodingException e) {
-		}
+		} 
 	}
 	
 	private void assertNotNull(String name, String value) throws CoreException {