Fix UTF-8 encoding.
This commit is contained in:
parent
21ec7b9526
commit
c114473368
1 changed files with 6 additions and 7 deletions
|
@ -52,13 +52,12 @@ import java.nio.charset.StandardCharsets;
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public final class GoogleSearch extends ThreadedModule {
|
public final class GoogleSearch extends ThreadedModule {
|
||||||
/**
|
|
||||||
* The google command.
|
|
||||||
*/
|
|
||||||
public static final String GOOGLE_CMD = "google";
|
|
||||||
|
|
||||||
// The Google API Key property.
|
// The Google API Key property.
|
||||||
private static final String GOOGLE_API_KEY_PROP = "google-api-key";
|
private static final String GOOGLE_API_KEY_PROP = "google-api-key";
|
||||||
|
|
||||||
|
// The Google command
|
||||||
|
private static final String GOOGLE_CMD = "google";
|
||||||
|
|
||||||
// The Google Custom Search Engine ID property.
|
// The Google Custom Search Engine ID property.
|
||||||
private static final String GOOGLE_CSE_KEY_PROP = "google-cse-cx";
|
private static final String GOOGLE_CSE_KEY_PROP = "google-cse-cx";
|
||||||
|
|
||||||
|
@ -93,7 +92,7 @@ public final class GoogleSearch extends ThreadedModule {
|
||||||
@SuppressFBWarnings(value = {"URLCONNECTION_SSRF_FD", "REC_CATCH_EXCEPTION"})
|
@SuppressFBWarnings(value = {"URLCONNECTION_SSRF_FD", "REC_CATCH_EXCEPTION"})
|
||||||
void run(final Mobibot bot, final String sender, final String query) {
|
void run(final Mobibot bot, final String sender, final String query) {
|
||||||
try {
|
try {
|
||||||
final String q = URLEncoder.encode(query, "UTF-8");
|
final String q = URLEncoder.encode(query, StandardCharsets.UTF_8.toString());
|
||||||
|
|
||||||
final URL url =
|
final URL url =
|
||||||
new URL("https://www.googleapis.com/customsearch/v1?key="
|
new URL("https://www.googleapis.com/customsearch/v1?key="
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue