File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -300,9 +300,14 @@ var jsoo_text_decoder = new TextDecoder();
300300
301301//Provides: caml_bytes_of_utf16_jsstring
302302//Requires: MlBytes, jsoo_text_encoder
303+ //Requires: jsoo_is_ascii
303304function caml_bytes_of_utf16_jsstring ( s ) {
304- var a = jsoo_text_encoder . encode ( s ) ;
305- return new MlBytes ( 4 , a , a . length ) ;
305+ if ( jsoo_is_ascii ( s ) ) {
306+ return new MlBytes ( 9 , s , s . length ) ;
307+ } else {
308+ var a = jsoo_text_encoder . encode ( s ) ;
309+ return new MlBytes ( 4 , a , a . length ) ;
310+ }
306311}
307312
308313//Provides: MlBytes
@@ -687,8 +692,10 @@ function caml_jsstring_of_string(s) {
687692//Provides: caml_string_of_jsstring const
688693//Requires: caml_string_of_array
689694//Requires: jsoo_text_encoder
695+ //Requires: jsoo_is_ascii, caml_string_of_jsbytes
690696//If: js-string
691697function caml_string_of_jsstring ( s ) {
698+ if ( jsoo_is_ascii ( s ) ) return caml_string_of_jsbytes ( s ) ;
692699 var a = jsoo_text_encoder . encode ( s ) ;
693700 return caml_string_of_array ( a ) ;
694701}
You can’t perform that action at this time.
0 commit comments