Index: trunk/src/org/openstreetmap/josm/data/Preferences.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 937)
+++ trunk/src/org/openstreetmap/josm/data/Preferences.java	(revision 938)
@@ -13,4 +13,5 @@
 import java.util.LinkedList;
 import java.util.Map;
+import java.util.Properties;
 import java.util.SortedMap;
 import java.util.StringTokenizer;
@@ -19,4 +20,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.preferences.ProxyPreferences;
 import org.openstreetmap.josm.tools.ColorHelper;
 
@@ -213,4 +215,5 @@
 	public void save() {
 		try {
+			setSystemProperties();
 			final PrintWriter out = new PrintWriter(new FileWriter(getPreferencesDir() + "preferences"), false);
 			for (final Entry<String, String> e : properties.entrySet()) {
@@ -241,4 +244,5 @@
 			throw new IOException("Malformed config file at lines " + errLines);
 		}
+		setSystemProperties();
 	}
 
@@ -377,3 +381,23 @@
 		return def;
 	}
+
+	private void setSystemProperties() {
+		Properties sysProp = System.getProperties();
+		if (getBoolean(ProxyPreferences.PROXY_ENABLE)) {
+			sysProp.put("proxySet", "true");
+			sysProp.put("http.proxyHost", get(ProxyPreferences.PROXY_HOST));
+			sysProp.put("proxyPort", get(ProxyPreferences.PROXY_PORT));
+			if (!getBoolean(ProxyPreferences.PROXY_ANONYMOUS)) {
+				sysProp.put("proxyUser", get(ProxyPreferences.PROXY_USER));
+				sysProp.put("proxyPassword", get(ProxyPreferences.PROXY_PASS));
+			}
+		} else {
+			sysProp.put("proxySet", "false");
+			sysProp.remove("http.proxyHost");
+			sysProp.remove("proxyPort");
+			sysProp.remove("proxyUser");
+			sysProp.remove("proxyPassword");
+		}
+		System.setProperties(sysProp);
+	}
 }
Index: trunk/src/org/openstreetmap/josm/gui/preferences/FilePreferences.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/FilePreferences.java	(revision 937)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/FilePreferences.java	(revision 938)
@@ -6,4 +6,6 @@
 import javax.swing.Box;
 import javax.swing.JCheckBox;
+import javax.swing.JSeparator;
+import javax.swing.SwingConstants;
 
 import org.openstreetmap.josm.Main;
@@ -21,8 +23,8 @@
 	
 	public void addGui(PreferenceDialog gui) {
+		gui.connection.add(new JSeparator(SwingConstants.HORIZONTAL), GBC.eol().fill(GBC.HORIZONTAL));
 		keepBackup.setSelected(Main.pref.getBoolean("save.keepbackup"));
 		keepBackup.setToolTipText(tr("When saving, keep backup files ending with a ~"));
 		gui.connection.add(keepBackup, GBC.eol().insets(20,0,0,0));
-		gui.connection.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL));
     }
 
Index: trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java	(revision 937)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java	(revision 938)
@@ -105,4 +105,5 @@
 		settings.add(new ServerAccessPreference());
 		settings.add(new FilePreferences());
+		settings.add(new ProxyPreferences());
 		settings.add(new ProjectionPreference());
 		settings.add(new TaggingPresetPreference());
Index: trunk/src/org/openstreetmap/josm/gui/preferences/ProxyPreferences.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/ProxyPreferences.java	(revision 938)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/ProxyPreferences.java	(revision 938)
@@ -0,0 +1,88 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.gui.preferences;
+
+import static org.openstreetmap.josm.tools.I18n.tr;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.Box;
+import javax.swing.JCheckBox;
+import javax.swing.JLabel;
+import javax.swing.JPasswordField;
+import javax.swing.JSeparator;
+import javax.swing.JTextField;
+import javax.swing.SwingConstants;
+
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.tools.GBC;
+
+public class ProxyPreferences implements PreferenceSetting {
+
+	public static final String PROXY_ENABLE = "proxy.enable";
+	public static final String PROXY_HOST = "proxy.host";
+	public static final String PROXY_PORT = "proxy.port";
+	public static final String PROXY_ANONYMOUS = "proxy.anonymous";
+	public static final String PROXY_USER = "proxy.user";
+	public static final String PROXY_PASS = "proxy.pass";
+
+	private JCheckBox proxyEnable = new JCheckBox(tr("Enable proxy server"));
+	private JTextField proxyHost = new JTextField(50);
+	private JTextField proxyPort = new JTextField(5);
+	private JCheckBox proxyAnonymous = new JCheckBox(tr("Anonymous"));
+	private JTextField proxyUser = new JTextField(50);
+	private JPasswordField proxyPass = new JPasswordField(50);
+
+	public void addGui(PreferenceDialog gui) {
+		proxyEnable.setSelected(Main.pref.getBoolean(PROXY_ENABLE));
+		proxyEnable.addActionListener(new ActionListener(){
+			public void actionPerformed(ActionEvent e) {
+				proxyHost.setEnabled(proxyEnable.isSelected());
+				proxyPort.setEnabled(proxyEnable.isSelected());
+				proxyAnonymous.setEnabled(proxyEnable.isSelected());
+				proxyUser.setEnabled(proxyEnable.isSelected() && proxyAnonymous.isSelected());
+				proxyPass.setEnabled(proxyEnable.isSelected() && proxyAnonymous.isSelected());
+			}
+		});
+		proxyHost.setEnabled(Main.pref.getBoolean(PROXY_ENABLE));
+		proxyHost.setText(Main.pref.get(PROXY_HOST));
+		proxyPort.setEnabled(Main.pref.getBoolean(PROXY_ENABLE));
+		proxyPort.setText(Main.pref.get(PROXY_PORT));
+		proxyAnonymous.setSelected(Main.pref.getBoolean(PROXY_ANONYMOUS));
+		proxyAnonymous.addActionListener(new ActionListener(){
+			public void actionPerformed(ActionEvent e) {
+				proxyUser.setEnabled(proxyEnable.isSelected() && proxyAnonymous.isSelected());
+				proxyPass.setEnabled(proxyEnable.isSelected() && proxyAnonymous.isSelected());
+			}
+		});
+		proxyUser.setEnabled(Main.pref.getBoolean(PROXY_ENABLE) && (Main.pref.getBoolean(PROXY_ANONYMOUS)));
+		proxyUser.setText(Main.pref.get(PROXY_USER));
+		proxyPass.setEnabled(Main.pref.getBoolean(PROXY_ENABLE) && (Main.pref.getBoolean(PROXY_ANONYMOUS)));
+		proxyPass.setText(Main.pref.get(PROXY_USER));
+		
+		gui.connection.add(new JSeparator(SwingConstants.HORIZONTAL), GBC.eol().fill(GBC.HORIZONTAL));
+		gui.connection.add(new JLabel(tr("Proxy Settings")), GBC.eol());
+		gui.connection.add(proxyEnable, GBC.eol().insets(20, 0, 0, 0));
+		gui.connection.add(new JLabel(tr("Proxy server host")), GBC.std());
+		gui.connection.add(proxyHost, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
+		gui.connection.add(new JLabel(tr("Proxy server port")), GBC.std());
+		gui.connection.add(proxyPort, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
+		gui.connection.add(proxyAnonymous, GBC.eop().insets(20, 0, 0, 0));
+		gui.connection.add(new JLabel(tr("Proxy server username")), GBC.std());
+		gui.connection.add(proxyUser, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
+		gui.connection.add(new JLabel(tr("Proxy server password")), GBC.std());
+		gui.connection.add(proxyPass, GBC.eol().fill(GBC.HORIZONTAL).insets(5,0,0,5));
+
+		gui.connection.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL));
+	}
+
+	public void ok() {
+		Main.pref.put(PROXY_ENABLE, proxyEnable.isSelected());
+		Main.pref.put(PROXY_HOST, proxyHost.getText());
+		Main.pref.put(PROXY_PORT, proxyPort.getText());
+		Main.pref.put(PROXY_ANONYMOUS, proxyAnonymous.isSelected());
+		Main.pref.put(PROXY_USER, proxyUser.getText());
+		Main.pref.put(PROXY_PASS, new String(proxyPass.getPassword()));
+	}
+
+}
Index: trunk/src/org/openstreetmap/josm/io/NmeaReader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/io/NmeaReader.java	(revision 937)
+++ trunk/src/org/openstreetmap/josm/io/NmeaReader.java	(revision 938)
@@ -162,12 +162,20 @@
 
 	private LatLon parseLatLon(String[] e) throws NumberFormatException {
-		String widthNorth = e[GPRMC.WIDTH_NORTH.position];
-		String lengthEast = e[GPRMC.LENGTH_EAST.position];
+		String widthNorth = e[GPRMC.WIDTH_NORTH.position].trim();
+		String lengthEast = e[GPRMC.LENGTH_EAST.position].trim();
 		if ("".equals(widthNorth) || "".equals(lengthEast)) {
 			return null;
 		}
 
-		int latdeg = Integer.parseInt(widthNorth.substring(0, 2));
-		double latmin = Double.parseDouble(widthNorth.substring(2));
+		// The format is xxDDLL.LLLL
+		// xx optional whitespace
+		// DD (int) degres
+		// LL.LLLL (double) latidude
+		int latdegsep = widthNorth.indexOf('.') - 2;
+		if (latdegsep < 0) {
+			return null;
+		}
+		int latdeg = Integer.parseInt(widthNorth.substring(0, latdegsep));
+		double latmin = Double.parseDouble(widthNorth.substring(latdegsep));
 		double lat = latdeg + latmin / 60;
 		if ("S".equals(e[GPRMC.WIDTH_NORTH_NAME.position])) {
@@ -175,6 +183,10 @@
 		}	
 
-		int londeg = Integer.parseInt(lengthEast.substring(0, 3));
-		double lonmin = Double.parseDouble(lengthEast.substring(3));
+		int londegsep = lengthEast.indexOf('.') - 2;
+		if (londegsep < 0) {
+			return null;
+		}
+		int londeg = Integer.parseInt(lengthEast.substring(0, londegsep));
+		double lonmin = Double.parseDouble(lengthEast.substring(londegsep));
 		double lon = londeg + lonmin / 60;
 		if ("W".equals(e[GPRMC.LENGTH_EAST_NAME.position])) {
