Permalink
Browse files

Don't ignore encodings from strings without it set

Those strings should be treated as strings with ASCII-8BIT encoding.
This change doesn't break any existing specs and also a regression spec
was added to make sure this behavior keeps working properly.

Fixes #2222
  • Loading branch information...
dbussink committed Mar 25, 2013
1 parent 7a0ce81 commit dcf6d75c7a200b25ab7c45f491d5e2f3e9a6cf62
Showing with 14 additions and 24 deletions.
  1. +7 −12 vm/instructions.def
  2. +7 −12 vm/llvm/jit_util.cpp
View
@@ -1528,21 +1528,16 @@ instruction string_build(count) [ +count -- string ]
}
if(!LANGUAGE_18_ENABLED(state)) {
- /* The String::encoding() accessor (without state) returns the raw
- * Encoding attribute. If it is only ever cNil or all values are the
- * same, we don't need to check Encoding compatibility later.
- *
+ /*
* TODO: Consider the case when -K is set (not implemented yet).
*/
if(!check_encoding) {
- Encoding* str_enc = str->encoding();
- if(!str_enc->nil_p()) {
- if(enc->nil_p()) {
- enc = str_enc;
- } else if(str_enc != enc) {
- check_encoding = true;
- enc = nil<Encoding>();
- }
+ Encoding* str_enc = str->encoding(state);
+ if(enc->nil_p()) {
+ enc = str_enc;
+ } else if(str_enc != enc) {
+ check_encoding = true;
+ enc = nil<Encoding>();
}
}
}
View
@@ -1109,21 +1109,16 @@ extern "C" {
}
if(!LANGUAGE_18_ENABLED(state)) {
- /* The String::encoding() accessor (without state) returns the raw
- * Encoding attribute. If it is only ever cNil or all values are the
- * same, we don't need to check Encoding compatibility later.
- *
+ /*
* TODO: Consider the case when -K is set (not implemented yet).
*/
if(!check_encoding) {
- Encoding* str_enc = str->encoding();
- if(!str_enc->nil_p()) {
- if(enc->nil_p()) {
- enc = str_enc;
- } else if(str_enc != enc) {
- check_encoding = true;
- enc = nil<Encoding>();
- }
+ Encoding* str_enc = str->encoding(state);
+ if(enc->nil_p()) {
+ enc = str_enc;
+ } else if(str_enc != enc) {
+ check_encoding = true;
+ enc = nil<Encoding>();
}
}
}

0 comments on commit dcf6d75

Please sign in to comment.