aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/org/traccar/ServerManager.java3
-rw-r--r--src/org/traccar/WebDataHandler.java7
2 files changed, 7 insertions, 3 deletions
diff --git a/src/org/traccar/ServerManager.java b/src/org/traccar/ServerManager.java
index 27e0fda05..08557a5d6 100644
--- a/src/org/traccar/ServerManager.java
+++ b/src/org/traccar/ServerManager.java
@@ -19,6 +19,7 @@ import java.io.File;
import java.net.URI;
import java.net.URL;
import java.net.URLDecoder;
+import java.nio.charset.StandardCharsets;
import java.util.Enumeration;
import java.util.LinkedList;
import java.util.List;
@@ -40,7 +41,7 @@ public class ServerManager {
URL packageUrl = Thread.currentThread().getContextClassLoader().getResource(packagePath);
if (packageUrl.getProtocol().equals("jar")) {
- String jarFileName = URLDecoder.decode(packageUrl.getFile(), "UTF-8");
+ String jarFileName = URLDecoder.decode(packageUrl.getFile(), StandardCharsets.UTF_8.name());
try (JarFile jf = new JarFile(jarFileName.substring(5, jarFileName.indexOf("!")))) {
Enumeration<JarEntry> jarEntries = jf.entries();
while (jarEntries.hasMoreElements()) {
diff --git a/src/org/traccar/WebDataHandler.java b/src/org/traccar/WebDataHandler.java
index f40d49a6d..688b4a840 100644
--- a/src/org/traccar/WebDataHandler.java
+++ b/src/org/traccar/WebDataHandler.java
@@ -17,6 +17,7 @@ package org.traccar;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
import java.util.Calendar;
import java.util.Formatter;
import java.util.Locale;
@@ -111,7 +112,8 @@ public class WebDataHandler extends BaseDataHandler {
if (position.getAddress() != null) {
try {
- request = request.replace("{address}", URLEncoder.encode(position.getAddress(), "UTF-8"));
+ request = request.replace(
+ "{address}", URLEncoder.encode(position.getAddress(), StandardCharsets.UTF_8.name()));
} catch (UnsupportedEncodingException error) {
Log.warning(error);
}
@@ -119,7 +121,8 @@ public class WebDataHandler extends BaseDataHandler {
if (request.contains("{attributes}")) {
try {
- request = request.replace("{attributes}", URLEncoder.encode(attributes, "UTF-8"));
+ request = request.replace(
+ "{attributes}", URLEncoder.encode(attributes, StandardCharsets.UTF_8.name()));
} catch (UnsupportedEncodingException error) {
Log.warning(error);
}