From e2bd16e638c85fcda112fe8a4e939b2d18d1d6b8 Mon Sep 17 00:00:00 2001 From: Harrison Shu <63772865+Har150n@users.noreply.github.com> Date: Tue, 30 Apr 2024 09:20:27 -0700 Subject: [PATCH] Revert "implemented URL encoding for Arabic and Hebrew translations" --- app/femr/util/translation/TranslationServer.java | 9 +-------- public/js/medical/medical.js | 1 - translator/server.py | 2 -- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/app/femr/util/translation/TranslationServer.java b/app/femr/util/translation/TranslationServer.java index 3cfa82169..87ce35e84 100644 --- a/app/femr/util/translation/TranslationServer.java +++ b/app/femr/util/translation/TranslationServer.java @@ -10,8 +10,6 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.util.Scanner; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; @Singleton public class TranslationServer { @@ -33,13 +31,9 @@ public static String makeServerRequest(String text, String from, String to) thro String response = ""; try { - // Harrison Shu - // Encode the URL String parameter before creating URL to allow arabic and hebrew to be in the URL - String encodedText = URLEncoder.encode(text, StandardCharsets.UTF_8.toString()); - //Make GET request URL url = new URL("http://localhost:" + portNumber +"/?text=" + - encodedText + "&from=" + from + "&to=" + to); + text + "&from=" + from + "&to=" + to); HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); con.connect(); @@ -51,7 +45,6 @@ public static String makeServerRequest(String text, String from, String to) thro con.disconnect(); } catch(IOException e){ - System.out.println(e) ; return makeServerRequest(text, from, to); } return response; diff --git a/public/js/medical/medical.js b/public/js/medical/medical.js index b2645b593..749201e10 100644 --- a/public/js/medical/medical.js +++ b/public/js/medical/medical.js @@ -352,7 +352,6 @@ $(document).ready(function () { $("#toggleBtn").text("Show Original"); var listTranslated = response.translation.split("@"); - var toLanguageIsRtl = response.toLanguageIsRtl; var fromLanguageIsRtl = response.fromLanguageIsRtl; diff --git a/translator/server.py b/translator/server.py index 3c071118e..708d999a5 100644 --- a/translator/server.py +++ b/translator/server.py @@ -42,8 +42,6 @@ def query_data(self): @cached_property def translate_data(self): - # Harrison Shu - # NOTE: Arabic and Hebrew Text is automatically decoded from the URL paramter text = self.query_data['text'] from_code = self.query_data['from'] to_code = self.query_data['to']