Changeset 29365 in osm for applications


Ignore:
Timestamp:
2013-03-15T18:42:29+01:00 (11 years ago)
Author:
roland
Message:

Fixed UTF8 character bug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mirrored_download/src/mirrored_download/MirroredDownloadAction.java

    r28912 r29365  
    77import java.awt.Component;
    88import java.awt.GridBagConstraints;
    9 
    109import java.awt.event.ActionEvent;
    1110import java.awt.event.KeyEvent;
     11import java.io.UnsupportedEncodingException;
     12import java.net.URLEncoder;
    1213import java.util.LinkedList;
    1314import java.util.concurrent.Future;
     
    160161        @Override
    161162        protected String getRequestForBbox(double lon1, double lat1, double lon2, double lat2) {
    162             return overpassQuery.isEmpty() && "*".equals(overpassType)
    163                     ? super.getRequestForBbox(lon1, lat1, lon2, lat2)
    164                     : overpassType + "[bbox=" + lon1 + "," + lat1 + "," + lon2 + "," + lat2 + "]"
    165                         + (MirroredDownloadPlugin.getAddMeta() ? "[@meta]" : "") + overpassQuery;
     163            if (overpassQuery.isEmpty() && "*".equals(overpassType))
     164                return super.getRequestForBbox(lon1, lat1, lon2, lat2);
     165            else
     166            {
     167                if (MirroredDownloadPlugin.getAddMeta())
     168                {
     169                    // Overpass compatibility layer
     170                    String url = overpassType + "[bbox=" + lon1 + "," + lat1 + "," + lon2 + "," + lat2 + "]"
     171                        + "[@meta]" + overpassQuery;
     172                    try
     173                    {
     174                        url = URLEncoder.encode(url, "UTF-8");
     175                    }
     176                    catch (UnsupportedEncodingException e)
     177                    {
     178                    }
     179                    return url;
     180                }
     181                else
     182                    // Old style XAPI
     183                    return overpassType + "[bbox=" + lon1 + "," + lat1 + "," + lon2 + "," + lat2 + "]"
     184                        + overpassQuery;
     185            }
    166186        }
    167187
Note: See TracChangeset for help on using the changeset viewer.