fix Lingva encoding issue

This commit is contained in:
Thomas 2023-07-22 15:15:43 +02:00
parent 958e4f6aa5
commit 870eeeb834

View file

@ -29,7 +29,6 @@ import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder;
import java.security.KeyManagementException; import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
@ -149,8 +148,8 @@ public class TransAsync {
str_response = new Client().post(MyTransL.getLibreTranslateUrl(), this.timeout, params); str_response = new Client().post(MyTransL.getLibreTranslateUrl(), this.timeout, params);
} else if (te == MyTransL.translatorEngine.LINGVA) { } else if (te == MyTransL.translatorEngine.LINGVA) {
String key = MyTransL.getInstance(te).getLibreTranslateAPIKey(); String key = MyTransL.getInstance(te).getLibreTranslateAPIKey();
String contentToSendEncoded = URLEncoder.encode(contentToSend, "UTF-8"); //String contentToSendEncoded = URLEncoder.encode(contentToSend, "UTF-8");
String lingvaURL = MyTransL.getLingvaUrl() + this.params.getSource_lang() + "/" + toLanguage + "/" + contentToSendEncoded; String lingvaURL = MyTransL.getLingvaUrl() + this.params.getSource_lang() + "/" + toLanguage + "/" + contentToSend;
str_response = new Client().get(lingvaURL, this.timeout); str_response = new Client().get(lingvaURL, this.timeout);
} }
} catch (IOException | NoSuchAlgorithmException | KeyManagementException err) { } catch (IOException | NoSuchAlgorithmException | KeyManagementException err) {