diff options
author | Tom Hennen <TomHennen@users.noreply.github.com> | 2015-08-13 18:27:43 -0400 |
---|---|---|
committer | Tom Hennen <TomHennen@users.noreply.github.com> | 2015-08-13 18:27:43 -0400 |
commit | 878850b924915df077c02b1bee2d339d68f66ff2 (patch) | |
tree | 7334b4efbc5c9c03a7461c04caf46badde7ef4c0 | |
parent | b332942f161f598d2c3247bdd073765a8ad51662 (diff) | |
parent | d17c8841129a2f33db7dec35d3eb616fd98040cf (diff) | |
download | AntennaPod-878850b924915df077c02b1bee2d339d68f66ff2.zip |
Merge pull request #1079 from mfietz/issue/1075-non-ascii-chars-in-url
Encode non-ascii query strings for the iTunes search
-rw-r--r-- | app/src/main/java/de/danoeh/antennapod/fragment/ItunesSearchFragment.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/ItunesSearchFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/ItunesSearchFragment.java index 16789d694..edd4da7fe 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/ItunesSearchFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/ItunesSearchFragment.java @@ -22,6 +22,8 @@ import org.json.JSONException; import org.json.JSONObject; import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.ArrayList; import java.util.List; @@ -31,7 +33,7 @@ import de.danoeh.antennapod.activity.OnlineFeedViewActivity; import de.danoeh.antennapod.adapter.itunes.ItunesAdapter; import de.danoeh.antennapod.core.preferences.UserPreferences; -import static de.danoeh.antennapod.adapter.itunes.ItunesAdapter.*; +import static de.danoeh.antennapod.adapter.itunes.ItunesAdapter.Podcast; //Searches iTunes store for given string and displays results in a list public class ItunesSearchFragment extends Fragment { @@ -160,8 +162,18 @@ public class ItunesSearchFragment extends Fragment { * * @param query Search string */ - public SearchTask(String query){ - this.query = query; + public SearchTask(String query) { + String encodedQuery = null; + try { + encodedQuery = URLEncoder.encode(query, "UTF-8"); + } catch(UnsupportedEncodingException e) { + // this won't ever be thrown + } + if(encodedQuery != null) { + this.query = encodedQuery; + } else { + this.query = query; // failsafe + } } //Get the podcast data |