Index: src/java/fr/jayasoft/ivy/Ivy.java
===================================================================
--- src/java/fr/jayasoft/ivy/Ivy.java	(revision 608)
+++ src/java/fr/jayasoft/ivy/Ivy.java	(working copy)
@@ -2198,9 +2198,9 @@
             md.setResolvedModuleRevisionId(ModuleRevisionId.newInstance(mrid, revision));
             md.setResolvedPublicationDate(pubdate);
         } catch (MalformedURLException e) {
-            throw new RuntimeException("malformed url obtained for file "+ivyFile);
+            throw new RuntimeException("malformed url obtained for file "+ivyFile , e);
         } catch (ParseException e) {
-            throw new IllegalStateException("bad ivy file in cache for "+mrid+": please clean and resolve again");
+            throw new RuntimeException("bad ivy file in cache for "+mrid+": please clean and resolve again" , e);
         }
         
         // 2) parse resolvedRevisions From properties file
@@ -2248,7 +2248,7 @@
                     new File(publishedIvy),
                     resolvedDependencies, status, revision, pubdate, null, true);
         } catch (SAXException ex) {
-            throw new IllegalStateException("bad ivy file in cache for "+mrid+": please clean and resolve again");
+            throw new RuntimeException("bad ivy file in cache for "+mrid+": please clean and resolve again" , ex);
         }
         
         Message.verbose("\tdeliver done ("+(System.currentTimeMillis()-start)+"ms)");
Index: src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorWriter.java
===================================================================
--- src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorWriter.java	(revision 608)
+++ src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorWriter.java	(working copy)
@@ -8,6 +8,7 @@
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.util.Arrays;
 import java.util.Collection;
@@ -30,8 +31,9 @@
         if (output.getParentFile() != null) {
             output.getParentFile().mkdirs();
         }
-        PrintWriter out = new PrintWriter(new FileOutputStream(output));
+        PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(output) , "UTF-8"));
         try {
+        	out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
 	        out.println("<ivy-module version=\"1.0\">"); 
 	    	out.println("\t<info organisation=\""+md.getModuleRevisionId().getOrganisation()+"\"");
 	    	out.println("\t\tmodule=\""+md.getModuleRevisionId().getName()+"\"");
Index: src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorUpdater.java
===================================================================
--- src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorUpdater.java	(revision 608)
+++ src/java/fr/jayasoft/ivy/xml/XmlModuleDescriptorUpdater.java	(working copy)
@@ -13,6 +13,7 @@
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
+import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.net.URL;
 import java.util.Arrays;
@@ -89,7 +90,7 @@
     public static void update(final Ivy ivy, InputStream inStream, OutputStream outStream, final Map resolvedRevisions, final String status, 
             final String revision, final Date pubdate, final Namespace ns, final boolean replaceInclude) 
                                 throws IOException, SAXException {
-        final PrintWriter out = new PrintWriter(outStream);
+        final PrintWriter out = new PrintWriter(new OutputStreamWriter(outStream , "UTF-8"));
         final BufferedInputStream in = new BufferedInputStream(inStream);
         
         in.mark(10000); // assume the header is never larger than 10000 bytes.
@@ -319,20 +320,27 @@
      * In fact, copies everything before <ivy-module to out, except
      * if <ivy-module is not found, in which case nothing is copied.
      * 
+     * The prolog <?xml version="..." encoding="...."?> is also replaced by
+     * <?xml version="1.0" encoding="UTF-8"?> if it was present.
+     * 
      * @param in
      * @param out
      * @throws IOException
      */
     private static void copyHeader(InputStream in, PrintWriter out) throws IOException {
-        StringBuffer buf = new StringBuffer();
         BufferedReader r = new BufferedReader(new InputStreamReader(in));
-        for (String line = r.readLine(); line != null; line = r.readLine()) {
+        String line = r.readLine();
+        if (line!=null && line.startsWith("<?xml ")) {
+        	out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+        	line = line.substring(line.indexOf(">")+1 , line.length());
+        }
+        for (; line != null; line = r.readLine()) {        	
             int index = line.indexOf("<ivy-module");
             if (index == -1) {
-                buf.append(line).append(LINE_SEPARATOR);
+                out.write(line);
+                out.write(LINE_SEPARATOR);
             } else {
-                buf.append(line.substring(0, index));
-                out.print(buf.toString());
+            	out.write(line.substring(0, index));
                 break;
             }
         }
