import java.io.IOException;
import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.AbstractMap;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
{
sb.append('&');
}
- sb.append(URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8));
+ try
+ {
+ sb.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
+ } catch (UnsupportedEncodingException e)
+ {
+ sb.append(entry.getKey());
+ }
sb.append('=');
- sb.append(
- URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8));
+ try
+ {
+ sb.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
+ } catch (UnsupportedEncodingException e)
+ {
+ sb.append(entry.getValue());
+ }
}
return sb.toString();
}
}
if (repeat >= 0 && whitespace != null)
{
- sb.append(whitespace.repeat(repeat));
+ // sb.append(whitespace.repeat(repeat));
+ sb.append(String.join("", Collections.nCopies(repeat, whitespace)));
+
}
else
{