diff options
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/Discover.java')
-rw-r--r-- | juick-www/src/main/java/com/juick/www/Discover.java | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/juick-www/src/main/java/com/juick/www/Discover.java b/juick-www/src/main/java/com/juick/www/Discover.java index 860ad893..9cfad874 100644 --- a/juick-www/src/main/java/com/juick/www/Discover.java +++ b/juick-www/src/main/java/com/juick/www/Discover.java @@ -20,6 +20,7 @@ package com.juick.www; import com.juick.server.AdsQueries; import com.juick.server.MessagesQueries; import com.juick.server.TagQueries; +import org.apache.commons.lang3.CharEncoding; import org.apache.commons.lang3.StringEscapeUtils; import org.springframework.jdbc.core.JdbcTemplate; @@ -41,21 +42,21 @@ public class Discover { protected void doGet(JdbcTemplate sql, JdbcTemplate sqlSearch, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { com.juick.User visitor = Utils.getVisitorUser(sql, request, response); - String paramTagStr = URLDecoder.decode(request.getRequestURI().substring(5), "UTF-8"); + String paramTagStr = URLDecoder.decode(request.getRequestURI().substring(5), CharEncoding.UTF_8); com.juick.Tag paramTag = TagQueries.getTag(sql, paramTagStr, false); if (paramTag == null) { Errors.doGet404(sql, request, response); return; } else if (paramTag.SynonymID > 0 && paramTag.TID != paramTag.SynonymID) { com.juick.Tag synTag = TagQueries.getTag(sql, paramTag.SynonymID); - String url = "/tag/" + URLEncoder.encode(synTag.getName(), "UTF-8"); + String url = "/tag/" + URLEncoder.encode(synTag.getName(), CharEncoding.UTF_8); if (request.getQueryString() != null) { url += "?" + request.getQueryString(); } Utils.sendPermanentRedirect(response, url); return; } else if (!paramTag.getName().equals(paramTagStr)) { - String url = "/tag/" + URLEncoder.encode(paramTag.getName(), "UTF-8"); + String url = "/tag/" + URLEncoder.encode(paramTag.getName(), CharEncoding.UTF_8); if (request.getQueryString() != null) { url += "?" + request.getQueryString(); } @@ -104,7 +105,7 @@ public class Discover { } if (mids.size() >= 20) { - String nextpage = "/tag/" + URLEncoder.encode(paramTag.getName(), "UTF-8") + "?before=" + mids.get(mids.size() - 1); + String nextpage = "/tag/" + URLEncoder.encode(paramTag.getName(), CharEncoding.UTF_8) + "?before=" + mids.get(mids.size() - 1); out.println("<p class=\"page\"><a href=\"" + nextpage + "\" rel=\"prev\">Читать дальше →</a></p>"); } |