diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-12-07 09:43:43 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-12-07 09:43:43 +1300 |
commit | 979314a9cfe4215fcf453759153bea67be4a7dd7 (patch) | |
tree | 6d3f31ed60a88a2bcd61cab0c5e147a8812e3a2e /src/org | |
parent | a20e996c0929bcca43e5b5595f7ec320fad3c213 (diff) | |
download | trackermap-server-979314a9cfe4215fcf453759153bea67be4a7dd7.tar.gz trackermap-server-979314a9cfe4215fcf453759153bea67be4a7dd7.tar.bz2 trackermap-server-979314a9cfe4215fcf453759153bea67be4a7dd7.zip |
Use UTF-8 name from standard library
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/traccar/ServerManager.java | 3 | ||||
-rw-r--r-- | src/org/traccar/WebDataHandler.java | 7 |
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); } |