Ignore:
Timestamp:
2009-02-09T16:57:02+01:00 (16 years ago)
Author:
stoecker
Message:

fix #1875

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/DirectUpload/src/org/openstreetmap/josm/plugins/DirectUpload/UploadDataGui.java

    r13497 r13634  
    2424import java.net.MalformedURLException;
    2525import java.net.URL;
     26import java.nio.ByteBuffer;
     27import java.nio.CharBuffer;
     28import java.nio.charset.Charset;
     29import java.nio.charset.CharsetEncoder;
     30import java.nio.charset.CharacterCodingException;
    2631import java.text.DateFormat;
    2732import java.text.SimpleDateFormat;
     
    167172        if(checkForErrors(username, password, description, gpxData))
    168173            return;
    169                                
    170                                 OkButton.setEnabled(false);
    171                                
     174               
     175        OkButton.setEnabled(false);
     176               
    172177        description = description.replaceAll("[&?/\\\\]"," ");
    173178        tags = tags.replaceAll("[&?/\\\\.,;]"," ");
     
    185190            connect.setRequestMethod("POST");
    186191            connect.setDoOutput(true);
    187             connect.addRequestProperty("Authorization", "Basic " + Base64.encode(username + ":" + password));
     192           
     193            CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder();
     194            String auth = username + ":" + password;
     195            ByteBuffer bytes = encoder.encode(CharBuffer.wrap(auth));
     196            connect.addRequestProperty("Authorization", "Basic " + Base64.encode(bytes));
     197           
    188198            connect.addRequestProperty("Content-Type", "multipart/form-data; boundary=" + BOUNDARY);
    189199            connect.addRequestProperty("Connection", "close"); // counterpart of keep-alive
Note: See TracChangeset for help on using the changeset viewer.