11/*
2- * Copyright (c) 2023, 2024 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2023, 2025 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * The Universal Permissive License (UPL), Version 1.0
@@ -690,13 +690,13 @@ private Object parseText(TruffleStringIterator iterator,
690690 InlinedBranchProfile errorBranch ) {
691691 var partialResult = Strings .builderCreate ();
692692 while (iterator .hasNext ()) {
693- int ch = iteratorNextNode .execute (iterator );
693+ int ch = iteratorNextNode .execute (iterator , TruffleString . Encoding . UTF_16 );
694694 if (ch == '\\' ) {
695695 if (!iterator .hasNext ()) {
696696 // Lone backslash at the end.
697697 return Undefined .instance ;
698698 }
699- final int next = iteratorNextNode .execute (iterator );
699+ final int next = iteratorNextNode .execute (iterator , TruffleString . Encoding . UTF_16 );
700700 switch (next ) {
701701 case '0' : {
702702 // only `\0` by itself is allowed but not e.g. `\02`.
@@ -741,8 +741,8 @@ private Object parseText(TruffleStringIterator iterator,
741741 appendCharNode .execute (partialResult , '\\' );
742742 break ;
743743 case '\r' : // CR | CRLF
744- if (iteratorNextNode .execute (iterator ) != '\n' ) {
745- iteratorPreviousNode .execute (iterator );
744+ if (iteratorNextNode .execute (iterator , TruffleString . Encoding . UTF_16 ) != '\n' ) {
745+ iteratorPreviousNode .execute (iterator , TruffleString . Encoding . UTF_16 );
746746 }
747747 break ;
748748 case '\n' :
@@ -789,8 +789,8 @@ private Object parseText(TruffleStringIterator iterator,
789789 }
790790
791791 private int peekNext (TruffleStringIterator iterator ) {
792- int ch = iteratorNextNode .execute (iterator );
793- iteratorPreviousNode .execute (iterator );
792+ int ch = iteratorNextNode .execute (iterator , TruffleString . Encoding . UTF_16 );
793+ iteratorPreviousNode .execute (iterator , TruffleString . Encoding . UTF_16 );
794794 return ch ;
795795 }
796796
@@ -806,13 +806,13 @@ private int unicodeEscapeSequence(TruffleStringIterator iterator,
806806
807807 private int varlenHexSequence (TruffleStringIterator iterator ,
808808 InlinedBranchProfile errorBranch ) {
809- int ch = iteratorNextNode .execute (iterator );
809+ int ch = iteratorNextNode .execute (iterator , TruffleString . Encoding . UTF_16 );
810810 assert ch == '{' ;
811811
812812 int value = 0 ;
813813 boolean firstIteration = true ;
814814 while (iterator .hasNext ()) {
815- ch = iteratorNextNode .execute (iterator );
815+ ch = iteratorNextNode .execute (iterator , TruffleString . Encoding . UTF_16 );
816816 if (ch == '}' ) {
817817 if (!firstIteration ) {
818818 break ;
@@ -846,7 +846,7 @@ private int hexSequence(TruffleStringIterator iterator, int length,
846846 int value = 0 ;
847847 int i ;
848848 for (i = 0 ; i < length && iterator .hasNext (); i ++) {
849- int ch = iteratorNextNode .execute (iterator );
849+ int ch = iteratorNextNode .execute (iterator , TruffleString . Encoding . UTF_16 );
850850 int digit = convertDigit (ch , 16 );
851851 if (digit == -1 ) {
852852 errorBranch .enter (this );
0 commit comments