File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -328,9 +328,15 @@ var jsoo_text_decoder = new TextDecoder();
328328
329329//Provides: caml_bytes_of_utf16_jsstring
330330//Requires: MlBytes, jsoo_text_encoder
331+ //Requires: jsoo_is_ascii
331332function caml_bytes_of_utf16_jsstring ( s ) {
332- var a = jsoo_text_encoder . encode ( s ) ;
333- return new MlBytes ( 4 , a , a . length ) ;
333+ if ( jsoo_is_ascii ( s ) ) {
334+ return new MlBytes ( 9 , s , s . length )
335+ }
336+ else {
337+ var a = jsoo_text_encoder . encode ( s ) ;
338+ return new MlBytes ( 4 , a , a . length ) ;
339+ }
334340}
335341
336342//Provides: MlBytes
@@ -697,8 +703,10 @@ function caml_jsstring_of_string(s) {
697703//Provides: caml_string_of_jsstring const
698704//Requires: caml_string_of_array
699705//Requires: jsoo_text_encoder
706+ //Requires: jsoo_is_ascii, caml_string_of_jsbytes
700707//If: js-string
701708function caml_string_of_jsstring ( s ) {
709+ if ( jsoo_is_ascii ( s ) ) return caml_string_of_jsbytes ( s ) ;
702710 var a = jsoo_text_encoder . encode ( s ) ;
703711 return caml_string_of_array ( a ) ;
704712}
You can’t perform that action at this time.
0 commit comments