Quantcast

[HtmlUnit] SVN: [14455] trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ html

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[HtmlUnit] SVN: [14455] trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ html

rbri
Revision: 14455
          http://sourceforge.net/p/htmlunit/code/14455
Author:   rbri
Date:     2017-05-15 18:41:37 +0000 (Mon, 15 May 2017)
Log Message:
-----------
javascript encoding detection uses page encoding as fallback

Modified Paths:
--------------
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElementSupport.java

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java 2017-05-14 17:46:05 UTC (rev 14454)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java 2017-05-15 18:41:37 UTC (rev 14455)
@@ -371,7 +371,10 @@
                 }
                 try {
                     executed_ = true;
-                    final Charset charset = EncodingSniffer.toCharset(getCharsetAttribute());
+                    Charset charset = EncodingSniffer.toCharset(getCharsetAttribute());
+                    if (charset == null) {
+                        charset = page.getCharset();
+                    }
                     final JavaScriptLoadResult result = page.loadExternalJavaScriptFile(src, charset);
                     if (result == JavaScriptLoadResult.SUCCESS) {
                         executeEvent(Event.TYPE_LOAD);

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElementSupport.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElementSupport.java 2017-05-14 17:46:05 UTC (rev 14454)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElementSupport.java 2017-05-15 18:41:37 UTC (rev 14455)
@@ -140,7 +140,10 @@
                 try {
                     final ScriptElement scriptElement = (ScriptElement) element;
                     scriptElement.setExecuted(true);
-                    final Charset charset = EncodingSniffer.toCharset(scriptElement.getCharsetAttribute());
+                    Charset charset = EncodingSniffer.toCharset(scriptElement.getCharsetAttribute());
+                    if (charset == null) {
+                        charset = page.getCharset();
+                    }
                     final JavaScriptLoadResult result = page.loadExternalJavaScriptFile(src, charset);
                     if (result == JavaScriptLoadResult.SUCCESS) {
                         executeEvent(element, Event.TYPE_LOAD);


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
HtmlUnit-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop
Loading...