Issue #6679 has been updated by naruse (Yui NARUSE). mame (Yusuke Endoh) wrote: > I'm happy to inform you that matz has (basically) accepted your > proposal. > > But not that the decision may be cancelled if the compatibility > impact is considered serious. > Naruse-san will implement and experiment it. diff --git a/lib/rexml/encoding.rb b/lib/rexml/encoding.rb index d1d5172..23e912f 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 112393c..7ecb98f 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 049e356..00e80a2 100644 --- a/parse.y +++ b/parse.y @@ -10558,7 +10558,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 ab4b674..5ab5ca2 100644 --- a/ruby.c +++ b/ruby.c @@ -1630,7 +1630,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 fc7bfa9..cb8bf44 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 d57614b..ccff224 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 90c0992..968ad97 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 fff55e1..856a994 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 d1edaaf..93967c6 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 dfcaa94..ce94886 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 c72035c..4810c6e 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 563e2ce..b5d31db 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 7e31e99..781af50 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/syck/test_yaml.rb b/test/syck/test_yaml.rb index 132bc92..c286b03 100644 --- a/test/syck/test_yaml.rb +++ b/test/syck/test_yaml.rb @@ -1,4 +1,4 @@ -# -*- mode: ruby; ruby-indent-level: 4; tab-width: 4; indent-tabs-mode: t -*- +# -*- coding: us-ascii; mode: ruby; ruby-indent-level: 4; tab-width: 4; indent-tabs-mode: t -*- # vim:sw=4:ts=4 # $Id$ # diff --git a/test/syslog/test_syslog_logger.rb b/test/syslog/test_syslog_logger.rb index 9224296..d382b4a 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' require 'syslog/logger' diff --git a/test/webrick/test_cgi.rb b/test/webrick/test_cgi.rb index d930c26..282183e 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" ---------------------------------------- Feature #6679: Default Ruby source file encoding to utf-8 https://bugs.ruby-lang.org/issues/6679#change-28371 Author: claytrump (Clay Trump) Status: Assigned Priority: Normal Assignee: naruse (Yui NARUSE) Category: Target version: Let's change the default encoding for Ruby source files from US-ASCII to UTF-8 in Ruby 2.0 ??? Convention over Configuration ??? Ruby 1.9 forced encoding for code that was not pure ASCII, so existing codebase already has magic comments. In Ruby 2.0, "# encoding: utf-8" can be the default. -- <lay trum/> -- http://bugs.ruby-lang.org/