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 @@ -286,9 +286,14 @@ var jsoo_text_decoder = new TextDecoder();
286286
287287//Provides: caml_bytes_of_utf16_jsstring
288288//Requires: MlBytes, jsoo_text_encoder
289+ //Requires: jsoo_is_ascii
289290function caml_bytes_of_utf16_jsstring ( s ) {
290- var a = jsoo_text_encoder . encode ( s ) ;
291- return new MlBytes ( 4 , a , a . length ) ;
291+ if ( jsoo_is_ascii ( s ) ) {
292+ return new MlBytes ( 9 , s , s . length ) ;
293+ } else {
294+ var a = jsoo_text_encoder . encode ( s ) ;
295+ return new MlBytes ( 4 , a , a . length ) ;
296+ }
292297}
293298
294299//Provides: MlBytes
@@ -648,8 +653,10 @@ function caml_jsstring_of_string(s) {
648653//Provides: caml_string_of_jsstring const
649654//Requires: caml_string_of_array
650655//Requires: jsoo_text_encoder
656+ //Requires: jsoo_is_ascii, caml_string_of_jsbytes
651657//If: js-string
652658function caml_string_of_jsstring ( s ) {
659+ if ( jsoo_is_ascii ( s ) ) return caml_string_of_jsbytes ( s ) ;
653660 var a = jsoo_text_encoder . encode ( s ) ;
654661 return caml_string_of_array ( a ) ;
655662}
You can’t perform that action at this time.
0 commit comments