[prev in list] [next in list] [prev in thread] [next in thread]
List: ruby-core
Subject: [ruby-core:70946] [Ruby trunk - Bug #11519] "#{nil}" produces string as US-ASCII rather than current
From: usa () garbagecollect ! jp
Date: 2015-09-29 8:40:46
Message-ID: redmine.journal-54309.20150929084044.72836c820cd304c1 () ruby-lang ! org
[Download RAW message or body]
Issue #11519 has been updated by Usaku NAKAMURA.
Backport changed from 2.0.0: WONTFIX, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: WONTFIX, \
2.1: DONE, 2.2: REQUIRED
ruby_2_1 r51978 merged revision(s) 51820.
----------------------------------------
Bug #11519: "#{nil}" produces string as US-ASCII rather than current encoding
https://bugs.ruby-lang.org/issues/11519#change-54309
* Author: Perry Smith
* Status: Closed
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
* Backport: 2.0.0: WONTFIX, 2.1: DONE, 2.2: REQUIRED
----------------------------------------
~~~ruby
#! /usr/bin/env ruby
# encoding: utf-8
puts "Ruby version: #{RUBY_VERSION}"
puts "__ENCODING__ = #{__ENCODING__}"
puts "hello".encoding
foo = "hello"
puts "#{foo}".encoding
puts "#{"hello"}".encoding
bar = nil
puts "#{bar}".encoding
puts "#{nil}".encoding
puts "#{bar}#{foo}".encoding
~~~
The output for this on all versions of ruby that I have except 1.9.1 is this:
~~~
Ruby version: 2.2.3
__ENCODING__ = UTF-8
UTF-8
UTF-8
UTF-8
US-ASCII
US-ASCII
US-ASCII
~~~
It is the last part that gave me grief. Rails `content_for` used such a construct so \
all my content was being converted to US-ASCII and sometimes were error off.
It seems to me the `"#{ ... }"` string should be utf-8 and so anything inserted into \
it should be converted to utf-8 so `"#{nil}"` should be utf-8 -- not US-ASCII.
--
https://bugs.ruby-lang.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic