From 19a1f65822a018b0b7a826df87d08daf72fcbb57 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 10 Oct 2018 19:33:36 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-11794=2010.0=E8=AE=BE=E8=AE=A1?= =?UTF-8?q?=E5=99=A8=E5=AE=89=E8=A3=85=E8=B7=AF=E5=BE=84=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E7=89=B9=E6=AE=8A=E7=AC=A6=E5=8F=B7=E4=BC=9A=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=AE=A1=E7=90=86=E7=95=8C=E9=9D=A2=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=8A=A0=E8=BD=BD=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/extra/PluginWebPane.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java b/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java index 3e2cafdfe..4257cb234 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java @@ -4,6 +4,7 @@ import com.fr.base.TemplateUtils; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; import com.fr.log.FineLoggerFactory; +import com.fr.stable.EncodeConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import javafx.application.Platform; @@ -32,6 +33,8 @@ import java.util.Map; public class PluginWebPane extends JFXPanel { private static final String RESOURCE_URL = "resourceURL"; private static final String LANGUAGE = "language"; + private static final String URL_PLUS = "+"; + private static final String URL_SPACING = "%20"; private WebEngine webEngine; public PluginWebPane(final String installHome, final String mainJs) { @@ -75,8 +78,9 @@ public class PluginWebPane extends JFXPanel { StringBuffer sb = new StringBuffer(); String line; Map map4Tpl = new HashMap(); - - map4Tpl.put(RESOURCE_URL, "file:///" + URLEncoder.encode(installHome, "UTF-8")); + //URL中关于空格的编码与空格所在位置相关:空格被编码成+的情况只能在查询字符串部分出现,而被编码成%20则可以出现在路径和查询字符串中 + //URLEncoder会将空格转成+,这边需要+转成%20 + map4Tpl.put(RESOURCE_URL, "file:///" + URLEncoder.encode(installHome, EncodeConstants.ENCODING_UTF_8).replace(URL_PLUS, URL_SPACING)); map4Tpl.put(LANGUAGE, GeneralContext.getLocale().toString()); while ((line = read.readLine()) != null) { if (sb.length() > 0) { From c030289603513e447a9b0d8f025cc6206b92fd97 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 10 Oct 2018 19:35:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/extra/PluginWebPane.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java b/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java index 4257cb234..627d16855 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginWebPane.java @@ -35,6 +35,7 @@ public class PluginWebPane extends JFXPanel { private static final String LANGUAGE = "language"; private static final String URL_PLUS = "+"; private static final String URL_SPACING = "%20"; + private static final String URL_PREFIX = "file:///"; private WebEngine webEngine; public PluginWebPane(final String installHome, final String mainJs) { @@ -80,7 +81,7 @@ public class PluginWebPane extends JFXPanel { Map map4Tpl = new HashMap(); //URL中关于空格的编码与空格所在位置相关:空格被编码成+的情况只能在查询字符串部分出现,而被编码成%20则可以出现在路径和查询字符串中 //URLEncoder会将空格转成+,这边需要+转成%20 - map4Tpl.put(RESOURCE_URL, "file:///" + URLEncoder.encode(installHome, EncodeConstants.ENCODING_UTF_8).replace(URL_PLUS, URL_SPACING)); + map4Tpl.put(RESOURCE_URL, URL_PREFIX + URLEncoder.encode(installHome, EncodeConstants.ENCODING_UTF_8).replace(URL_PLUS, URL_SPACING)); map4Tpl.put(LANGUAGE, GeneralContext.getLocale().toString()); while ((line = read.readLine()) != null) { if (sb.length() > 0) {