Skip to content

Commit caf6c11

Browse files
committed
// BH 2021.12.15 default encoding for String.getBytes() should be utf-8.
1 parent 474863b commit caf6c11

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

sources/net.sf.j2s.java.core/srcjs/js/j2sClazz.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
// Google closure compiler cannot handle Clazz.new or Clazz.super
99

10-
// BH 2021.08.16 fix for Interface initalizing its subclass with static initialization
10+
// BH 2021.12.15 default encoding for String.getBytes() should be utf-8.
11+
// BH 2021.08.16 fix for Interface initializing its subclass with static initialization
1112
// BH 2021.07.28 String.instantialize upgraded to use TextDecoder() if possible (not in MSIE)
1213
// BH 2021.07.20 Date.toString() format yyyy moved to end, as in Java
1314
// BH 2021.06.11 Number.compareTo(....) missing
@@ -5891,8 +5892,7 @@ sp.getBytes$I$I$BA$I=function(i0, i1, dst, dpt) {
58915892

58925893
sp.getBytes$=sp.getBytes$S=sp.getBytes$java_nio_charset_Charset=function(){
58935894
var s=this;
5894-
if(arguments.length==1){
5895-
var cs=arguments[0].toString().toLowerCase();
5895+
var cs = (arguments.length == 1 ? arguments[0] : "utf-8").toString().toLowerCase();
58965896
var simple=false;
58975897
for(var i=0;i<charset.length;i++){
58985898
if(charset[i]==cs){
@@ -5911,7 +5911,6 @@ if(arguments.length==1){
59115911
if(cs=="utf-8"||cs=="utf8"){
59125912
s=E.convert2UTF8(this);
59135913
}
5914-
}
59155914
var arrs=[];
59165915
for(var i=0, ii=0;i<s.length;i++){
59175916
var c=s.charCodeAt(i);

0 commit comments

Comments
 (0)