Index: /trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 4429)
+++ /trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java	(revision 4430)
@@ -2,4 +2,5 @@
 package org.openstreetmap.josm.data.imagery;
 
+import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -138,4 +139,13 @@
         }
         res.add(shapesString.isEmpty() ? null : shapesString);
+        if(serverProjections != null && serverProjections.size() != 0) {
+            String val = "";
+            for(String p : serverProjections) {
+                if(!val.isEmpty())
+                    val += ",";
+                val += p;
+            }
+            res.add(val);
+        }
         return res;
     }
@@ -184,4 +194,7 @@
                 Main.warn(e.toString());
             }
+        }
+        if(array.size() >= 11 && !array.get(10).isEmpty()) {
+            serverProjections = Arrays.asList(array.get(10).split(","));
         }
     }
@@ -202,4 +215,5 @@
         this.attributionText = i.attributionText;
         this.termsOfUseURL = i.termsOfUseURL;
+        this.serverProjections = i.serverProjections;
     }
 
Index: /trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 4429)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/WMSLayer.java	(revision 4430)
@@ -38,4 +38,5 @@
 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener;
 import org.openstreetmap.josm.data.ProjectionBounds;
+import org.openstreetmap.josm.data.projection.Mercator;
 import org.openstreetmap.josm.data.projection.Projection;
 import org.openstreetmap.josm.data.coor.EastNorth;
@@ -930,5 +931,6 @@
     @Override
     public boolean isProjectionSupported(Projection proj) {
-        return serverProjections == null || serverProjections.contains(proj.toCode().toUpperCase());
+        return serverProjections == null || serverProjections.contains(proj.toCode().toUpperCase())
+        || (proj instanceof Mercator && serverProjections.contains("EPSG:4326"));
     }
 
Index: /trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java	(revision 4429)
+++ /trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java	(revision 4430)
@@ -41,5 +41,5 @@
         ENTRY_ATTRIBUTE,    // note we are inside an entry attribute to collect the character data
         SUPPORTED_PROJECTIONS,
-        PR,
+        SRS,
         BOUNDS,
         SHAPE,
@@ -52,129 +52,18 @@
 
     public List<ImageryInfo> parse() throws SAXException, IOException {
-        if (isXml(source)) {
-            Parser parser = new Parser();
-            try {
-                SAXParserFactory factory = SAXParserFactory.newInstance();
-                factory.setNamespaceAware(true);
-                InputStream in = new MirroredInputStream(source);
-                InputSource is = new InputSource(UTFInputStreamReader.create(in, "UTF-8"));
-                factory.newSAXParser().parse(is, parser);
-                return parser.entries;
-            } catch (SAXException e) {
-                throw e;
-            } catch (ParserConfigurationException e) {
-                e.printStackTrace(); // broken SAXException chaining
-                throw new SAXException(e);
-            }
-        } else {
-            return readCSV(source);
-        }
-    }
-
-    /**
-     * Probe the file to see if it is xml or the traditional csv format.
-     * 
-     * If the first non-whitespace character is a '<', decide for
-     * xml, otherwise csv.
-     */
-    private boolean isXml(String source) {
-        MirroredInputStream in = null;
+        Parser parser = new Parser();
         try {
-            in = new MirroredInputStream(source);
-            InputStreamReader reader = UTFInputStreamReader.create(in, null);
-            WHILE: while (true) {
-                int c = reader.read();
-                switch (c) {
-                    case -1:
-                        break WHILE;
-                    case ' ':
-                    case '\t':
-                    case '\n':
-                    case '\r':
-                        continue;
-                    case '<':
-                        return true;
-                    default:
-                        return false;
-                }
-            }
-        } catch (IOException ex) {
-            ex.printStackTrace();
-        } finally {
-            Utils.close(in);
-        }
-        Main.warn(tr("Warning: Could not detect type of imagery source ''{0}''. Using default (xml).", source));
-        return true;
-    }
-
-    private List<ImageryInfo> readCSV(String source) {
-        List<ImageryInfo> entries = new ArrayList<ImageryInfo>();
-        MirroredInputStream s = null;
-        try {
-            s = new MirroredInputStream(source);
-            try {
-                InputStreamReader r;
-                try
-                {
-                    r = new InputStreamReader(s, "UTF-8");
-                }
-                catch (UnsupportedEncodingException e)
-                {
-                    r = new InputStreamReader(s);
-                }
-                BufferedReader reader = new BufferedReader(r);
-                String line;
-                while((line = reader.readLine()) != null)
-                {
-                    String val[] = line.split(";");
-                    if(!line.startsWith("#") && val.length >= 3) {
-                        boolean defaultEntry = "true".equals(val[0]);
-                        String name = tr(val[1]);
-                        String url = val[2];
-                        String eulaAcceptanceRequired = null;
-
-                        if (val.length >= 4 && !val[3].isEmpty()) {
-                            // 4th parameter optional for license agreement (EULA)
-                            eulaAcceptanceRequired = val[3];
-                        }
-
-                        ImageryInfo info = new ImageryInfo(name, url, eulaAcceptanceRequired);
-                        
-                        info.setDefaultEntry(defaultEntry);
-
-                        if (val.length >= 5 && !val[4].isEmpty()) {
-                            // 5th parameter optional for bounds
-                            try {
-                                info.setBounds(new ImageryBounds(val[4], ","));
-                            } catch (IllegalArgumentException e) {
-                                Main.warn(e.toString());
-                            }
-                        }
-                        if (val.length >= 6 && !val[5].isEmpty()) {
-                            info.setAttributionText(val[5]);
-                        }
-                        if (val.length >= 7 && !val[6].isEmpty()) {
-                            info.setAttributionLinkURL(val[6]);
-                        }
-                        if (val.length >= 8 && !val[7].isEmpty()) {
-                            info.setTermsOfUseURL(val[7]);
-                        }
-                        if (val.length >= 9 && !val[8].isEmpty()) {
-                            info.setAttributionImage(val[8]);
-                        }
-
-                        entries.add(info);
-                    }
-                }
-            } finally {
-                Utils.close(s);
-            }
-            return entries;
-        } catch (IOException ex) {
-            ex.printStackTrace();
-        } finally {
-            Utils.close(s);
-        }
-        return entries;
+            SAXParserFactory factory = SAXParserFactory.newInstance();
+            factory.setNamespaceAware(true);
+            InputStream in = new MirroredInputStream(source);
+            InputSource is = new InputSource(UTFInputStreamReader.create(in, "UTF-8"));
+            factory.newSAXParser().parse(is, parser);
+            return parser.entries;
+        } catch (SAXException e) {
+            throw e;
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace(); // broken SAXException chaining
+            throw new SAXException(e);
+        }
     }
 
@@ -275,6 +164,6 @@
                     break;
                 case SUPPORTED_PROJECTIONS:
-                    if (qName.equals("pr")) {
-                        newState = State.PR;
+                    if (qName.equals("srs")) {
+                        newState = State.SRS;
                     }
                     break;
@@ -383,5 +272,5 @@
                     shape = null;
                     break;
-                case PR:
+                case SRS:
                     supported_srs.add(accumulator.toString());
                     break;
Index: /trunk/src/org/openstreetmap/josm/io/imagery/WMSGrabber.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/imagery/WMSGrabber.java	(revision 4429)
+++ /trunk/src/org/openstreetmap/josm/io/imagery/WMSGrabber.java	(revision 4430)
@@ -96,4 +96,5 @@
         String srs = "";
         boolean useepsg = false;
+        // FIXME: Non-Pattern format should be dropped in future
         try
         {
@@ -103,5 +104,5 @@
                 if(m.group(1).equals("EPSG:4326") && Main.getProjection() instanceof Mercator)
                     useepsg = true;
-            } else if(Main.getProjection() instanceof Mercator) {
+            } else if((Main.getProjection() instanceof Mercator) && !serverProjections.contains(myProj)) {
                 useepsg = true;
                 srs ="&srs=EPSG:4326";
@@ -156,4 +157,7 @@
     {
         ArrayList<String> serverProjections = new ArrayList<String>();
+        boolean hasepsg = false;
+        
+        // FIXME: Non-Pattern format should be dropped in future
         try
         {
@@ -161,5 +165,4 @@
             if(m.matches())
             {
-                boolean hasepsg = false;
                 for(String p : m.group(1).split(","))
                 {
@@ -168,6 +171,4 @@
                         hasepsg = true;
                 }
-                if(hasepsg && !serverProjections.contains(new Mercator().toCode()))
-                    serverProjections.add(new Mercator().toCode());
             }
             else
@@ -178,5 +179,5 @@
                     serverProjections.add(m.group(1));
                     if(m.group(1).equals("EPSG:4326"))
-                        serverProjections.add(new Mercator().toCode());
+                        hasepsg = true;
                 }
                 /* TODO: here should be an "else" code checking server capabilities */
@@ -191,5 +192,6 @@
         {
             String myProj = Main.getProjection().toCode().toUpperCase();
-            if(!serverProjections.contains(myProj))
+            if(!serverProjections.contains(myProj) &&
+            !(Main.getProjection() instanceof Mercator && serverProjections.contains("EPSG:4326")))
             {
                 JOptionPane.showMessageDialog(Main.parent,
