summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-06 00:49:57 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-06 00:49:57 +0000
commit58ef0f06c6f6fcc4f6a0d31ade430d87ef9d968d (patch)
tree093a990de85f3b383db90c2c9d82c66bc98f63a1
parentc9fc6b08ae515a22293a4a44fe1f0d8452b88183 (diff)
* ruby.c (load_file_internal): set default source encoding as
UTF-8 instead of US-ASCII. [ruby-core:46021] [Feature #6679] * parse.y (parser_initialize): set default parser encoding as UTF-8 instead of US-ASCII. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--NEWS2
-rw-r--r--lib/rexml/encoding.rb1
-rw-r--r--lib/rexml/source.rb1
-rw-r--r--parse.y2
-rw-r--r--ruby.c2
-rw-r--r--test/base64/test_base64.rb1
-rw-r--r--test/dl/test_import.rb1
-rw-r--r--test/logger/test_logger.rb1
-rw-r--r--test/net/http/test_http.rb3
-rw-r--r--test/net/http/test_httpresponse.rb1
-rw-r--r--test/openssl/test_x509name.rb1
-rw-r--r--test/psych/test_yaml.rb2
-rw-r--r--test/psych/visitors/test_to_ruby.rb1
-rw-r--r--test/ripper/test_ripper.rb2
-rw-r--r--test/ruby/test_array.rb1
-rw-r--r--test/ruby/test_io.rb1
-rw-r--r--test/ruby/test_io_m17n.rb1
-rw-r--r--test/ruby/test_m17n.rb1
-rw-r--r--test/ruby/test_pack.rb1
-rw-r--r--test/ruby/test_parse.rb1
-rw-r--r--test/ruby/test_regexp.rb1
-rw-r--r--test/syslog/test_syslog_logger.rb1
-rw-r--r--test/webrick/test_cgi.rb1
24 files changed, 32 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 6cf8f24..bcad80d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue Nov 6 09:37:57 2012 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * ruby.c (load_file_internal): set default source encoding as
+ UTF-8 instead of US-ASCII. [ruby-core:46021] [Feature #6679]
+
+ * parse.y (parser_initialize): set default parser encoding as
+ UTF-8 instead of US-ASCII.
+
Tue Nov 6 05:48:06 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
* test/ruby/test_require.rb
diff --git a/NEWS b/NEWS
index 1e31e58..df737c4 100644
--- a/NEWS
+++ b/NEWS
@@ -248,6 +248,8 @@ with all sufficient information, see the ChangeLog file.
* Added %i and %I for symbol list creation (similar to %w and %W).
+ * Default source encoding is changed to UTF-8. (was US-ASCII)
+
=== Compatibility issues (excluding feature bug fixes)
* Signal.trap
diff --git a/lib/rexml/encoding.rb b/lib/rexml/encoding.rb
index 2863af9..1c7e79a 100644
--- a/lib/rexml/encoding.rb
+++ b/lib/rexml/encoding.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
module REXML
module Encoding
# ID ---> Encoding name
diff --git a/lib/rexml/source.rb b/lib/rexml/source.rb
index eec1b6c..b653714 100644
--- a/lib/rexml/source.rb
+++ b/lib/rexml/source.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'rexml/encoding'
module REXML
diff --git a/parse.y b/parse.y
index 5f36175..e043e99 100644
--- a/parse.y
+++ b/parse.y
@@ -10580,7 +10580,7 @@ parser_initialize(struct parser_params *parser)
#ifdef YYMALLOC
parser->heap = NULL;
#endif
- parser->enc = rb_usascii_encoding();
+ parser->enc = rb_utf8_encoding();
}
#ifdef RIPPER
diff --git a/ruby.c b/ruby.c
index df749e0..8654f87 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1692,7 +1692,7 @@ load_file_internal(VALUE arg)
enc = rb_locale_encoding();
}
else {
- enc = rb_usascii_encoding();
+ enc = rb_utf8_encoding();
}
if (NIL_P(f)) {
f = rb_str_new(0, 0);
diff --git a/test/base64/test_base64.rb b/test/base64/test_base64.rb
index 9ae54cb..c5e61b3 100644
--- a/test/base64/test_base64.rb
+++ b/test/base64/test_base64.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require "test/unit"
require "base64"
diff --git a/test/dl/test_import.rb b/test/dl/test_import.rb
index 26b9f3c..41def7c 100644
--- a/test/dl/test_import.rb
+++ b/test/dl/test_import.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require_relative 'test_base'
require 'dl/import'
diff --git a/test/logger/test_logger.rb b/test/logger/test_logger.rb
index 8fc02f8..100c1ea 100644
--- a/test/logger/test_logger.rb
+++ b/test/logger/test_logger.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'test/unit'
require 'logger'
require 'tempfile'
diff --git a/test/net/http/test_http.rb b/test/net/http/test_http.rb
index 6a35ca2..0dfb462 100644
--- a/test/net/http/test_http.rb
+++ b/test/net/http/test_http.rb
@@ -1,5 +1,4 @@
-# $Id$
-
+# coding: US-ASCII
require 'test/unit'
require 'net/http'
require 'stringio'
diff --git a/test/net/http/test_httpresponse.rb b/test/net/http/test_httpresponse.rb
index 70313cc..a4f242d 100644
--- a/test/net/http/test_httpresponse.rb
+++ b/test/net/http/test_httpresponse.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'net/http'
require 'test/unit'
require 'stringio'
diff --git a/test/openssl/test_x509name.rb b/test/openssl/test_x509name.rb
index 0a22343..de35fc3 100644
--- a/test/openssl/test_x509name.rb
+++ b/test/openssl/test_x509name.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require_relative 'utils'
if defined?(OpenSSL)
diff --git a/test/psych/test_yaml.rb b/test/psych/test_yaml.rb
index 807c058..796a44f 100644
--- a/test/psych/test_yaml.rb
+++ b/test/psych/test_yaml.rb
@@ -1,4 +1,4 @@
-# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4 -*-
+# -*- coding: us-ascii; mode: ruby; ruby-indent-level: 4; tab-width: 4 -*-
# vim:sw=4:ts=4
# $Id$
#
diff --git a/test/psych/visitors/test_to_ruby.rb b/test/psych/visitors/test_to_ruby.rb
index 5b0702c..ee473c9 100644
--- a/test/psych/visitors/test_to_ruby.rb
+++ b/test/psych/visitors/test_to_ruby.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'psych/helper'
module Psych
diff --git a/test/ripper/test_ripper.rb b/test/ripper/test_ripper.rb
index 72dc52d..1d6e893 100644
--- a/test/ripper/test_ripper.rb
+++ b/test/ripper/test_ripper.rb
@@ -17,7 +17,7 @@ class TestRipper::Ripper < Test::Unit::TestCase
end
def test_encoding
- assert_equal Encoding::US_ASCII, @ripper.encoding
+ assert_equal Encoding::UTF_8, @ripper.encoding
end
def test_end_seen_eh
diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb
index 845a050..b0e7058 100644
--- a/test/ruby/test_array.rb
+++ b/test/ruby/test_array.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'test/unit'
require_relative 'envutil'
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index ddc5f8c..d092484 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'test/unit'
require 'tmpdir'
require "fcntl"
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb
index b6358e0..3cc8437 100644
--- a/test/ruby/test_io_m17n.rb
+++ b/test/ruby/test_io_m17n.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'test/unit'
require 'tmpdir'
require 'timeout'
diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb
index 8756334..7e343ab 100644
--- a/test/ruby/test_m17n.rb
+++ b/test/ruby/test_m17n.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'test/unit'
require_relative 'envutil'
diff --git a/test/ruby/test_pack.rb b/test/ruby/test_pack.rb
index 1463bd0..76956ef 100644
--- a/test/ruby/test_pack.rb
+++ b/test/ruby/test_pack.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'test/unit'
class TestPack < Test::Unit::TestCase
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb
index 8623960..319af75 100644
--- a/test/ruby/test_parse.rb
+++ b/test/ruby/test_parse.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'test/unit'
require 'stringio'
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 0825e94..de89a67 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'test/unit'
require 'envutil'
diff --git a/test/syslog/test_syslog_logger.rb b/test/syslog/test_syslog_logger.rb
index 3a659cf..f34025d 100644
--- a/test/syslog/test_syslog_logger.rb
+++ b/test/syslog/test_syslog_logger.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require 'test/unit'
require 'tempfile'
begin
diff --git a/test/webrick/test_cgi.rb b/test/webrick/test_cgi.rb
index 72e3be9..d2d5417 100644
--- a/test/webrick/test_cgi.rb
+++ b/test/webrick/test_cgi.rb
@@ -1,3 +1,4 @@
+# coding: US-ASCII
require_relative "utils"
require "webrick"
require "test/unit"