-
-
Save cheald/feff996b01f5937abfd7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/core/src/main/java/org/jruby/ast/SymbolNode.java b/core/src/main/java/org/jruby/ast/SymbolNode.java | |
index 747f28a..aa4d811 100644 | |
--- a/core/src/main/java/org/jruby/ast/SymbolNode.java | |
+++ b/core/src/main/java/org/jruby/ast/SymbolNode.java | |
@@ -48,6 +48,7 @@ import org.jruby.runtime.Block; | |
import org.jruby.runtime.ThreadContext; | |
import org.jruby.runtime.builtin.IRubyObject; | |
import org.jruby.util.ByteList; | |
+import org.jruby.util.StringSupport; | |
/** | |
* Represents a symbol (:symbol_name). | |
@@ -67,9 +68,10 @@ public class SymbolNode extends Node implements ILiteralNode, INameNode { | |
public SymbolNode(ISourcePosition position, ByteList value) { | |
super(position); | |
this.name = value.toString().intern(); | |
+ | |
// FIXME: A full scan to determine whether we should back off to US-ASCII. Lexer should just do this properly. | |
- if (value.lengthEnc() == value.length()) { | |
- this.encoding = USASCIIEncoding.INSTANCE; | |
+ if (value.getEncoding().isAsciiCompatible() && StringSupport.codeRangeScan(value.getEncoding(), value) == StringSupport.CR_7BIT) { | |
+ encoding = USASCIIEncoding.INSTANCE; | |
} else { | |
this.encoding = value.getEncoding(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment