File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
src/main/java/org/truffleruby/parser Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -2760,8 +2760,21 @@ private RubyNode executeOrInheritBlock(RubyNode blockNode) {
2760
2760
2761
2761
@ Override
2762
2762
public RubyNode visitSymbolNode (Nodes .SymbolNode node ) {
2763
- var tstring = TStringUtils .fromByteArray (node .unescaped , sourceEncoding );
2764
- final RubySymbol symbol = language .getSymbol (tstring , sourceEncoding );
2763
+ final RubyEncoding encoding ;
2764
+
2765
+ if (node .isForcedUtf8Encoding ()) {
2766
+ encoding = Encodings .UTF_8 ;
2767
+ } else if (node .isForcedUsAsciiEncoding ()) {
2768
+ encoding = Encodings .US_ASCII ;
2769
+ } else if (node .isForcedBinaryEncoding ()) {
2770
+ encoding = Encodings .BINARY ;
2771
+ } else {
2772
+ encoding = sourceEncoding ;
2773
+ }
2774
+
2775
+ var tstring = TStringUtils .fromByteArray (node .unescaped , encoding );
2776
+ final RubySymbol symbol = language .getSymbol (tstring , encoding );
2777
+
2765
2778
final RubyNode rubyNode = new ObjectLiteralNode (symbol );
2766
2779
return assignPositionAndFlags (node , rubyNode );
2767
2780
}
You can’t perform that action at this time.
0 commit comments