https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112011-09-07T08:02:52ZRuby Issue Tracking SystemBackport193 - Backport #5287: 1.9.3 - Interpolation in a string causes the string's encoding to be set to ASCII-8BIThttps://bugs.ruby-lang.org/issues/5287?journal_id=206352011-09-07T08:02:52Zjonleighton (Jon Leighton)j@jonathanleighton.com
<ul></ul><p>To be clear about the version tested:</p>
<p>$ ruby -v<br>
ruby 1.9.3dev (2011-09-05 revision 33190) [x86_64-linux]</p> Backport193 - Backport #5287: 1.9.3 - Interpolation in a string causes the string's encoding to be set to ASCII-8BIThttps://bugs.ruby-lang.org/issues/5287?journal_id=206362011-09-07T08:07:03Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Tracker</strong> changed from <i>Bug</i> to <i>Backport</i></li><li><strong>Project</strong> changed from <i>Ruby master</i> to <i>Backport193</i></li><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>naruse (Yui NARUSE)</i></li><li><strong>Priority</strong> changed from <i>Normal</i> to <i>5</i></li></ul><p>Backport r32791.</p> Backport193 - Backport #5287: 1.9.3 - Interpolation in a string causes the string's encoding to be set to ASCII-8BIThttps://bugs.ruby-lang.org/issues/5287?journal_id=206922011-09-09T16:02:46Znaruse (Yui NARUSE)naruse@airemix.jp
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Closed</i></li></ul><p>Backported in r33236.</p> Backport193 - Backport #5287: 1.9.3 - Interpolation in a string causes the string's encoding to be set to ASCII-8BIThttps://bugs.ruby-lang.org/issues/5287?journal_id=206972011-09-09T20:53:11Zaprescott (Adam Prescott)
<ul></ul><p>On Wed, Sep 7, 2011 at 12:20 AM, Adam Prescott <a href="mailto:adam@aprescott.com" class="email">adam@aprescott.com</a> wrote:</p>
<blockquote>
<p>Since "#{a}" is actually a new string, doesn't it make sense that its<br>
encoding should be the default internal encoding? I can see "#{a}" being<br>
used with the encoding change actually expected.</p>
</blockquote>
<p>I guess "no" is the answer?</p>
<p>What about "foo#{a}bar"? Would that have the same encoding result as<br>
"#{a}", or is the latter just a special case? (Either choice seems<br>
counterintuitive to me.)</p> Backport193 - Backport #5287: 1.9.3 - Interpolation in a string causes the string's encoding to be set to ASCII-8BIThttps://bugs.ruby-lang.org/issues/5287?journal_id=207012011-09-09T23:07:01Znaruse (Yui NARUSE)naruse@airemix.jp
<ul></ul><p>Adam Prescott wrote:</p>
<blockquote>
<p>On Wed, Sep 7, 2011 at 12:20 AM, Adam Prescott <a href="mailto:adam@aprescott.com" class="email">adam@aprescott.com</a> wrote:</p>
<blockquote>
<p>Since "#{a}" is actually a new string, doesn't it make sense that its<br>
encoding should be the default internal encoding? I can see "#{a}" being<br>
used with the encoding change actually expected.</p>
</blockquote>
<p>I guess "no" is the answer?</p>
</blockquote>
<p>default_internal doesn't effect on this situation.<br>
"#{a}" is considered as ` s = a.to_s<br>
So "no" is the answer, s's encoding depends a's encoding.</p>
<blockquote>
<p>What about "foo#{a}bar"? Would that have the same encoding result as<br>
"#{a}", or is the latter just a special case? (Either choice seems<br>
counterintuitive to me.)</p>
</blockquote>
<p>"foo#{a}bar" is considered as ` s = "foo"; s.concat(a.to_s); s.concat("bar").<br>
So the resulted s's encoding depends "foo".</p> Backport193 - Backport #5287: 1.9.3 - Interpolation in a string causes the string's encoding to be set to ASCII-8BIThttps://bugs.ruby-lang.org/issues/5287?journal_id=207042011-09-10T02:29:12Zaprescott (Adam Prescott)
<ul></ul><p>On Fri, Sep 9, 2011 at 3:07 PM, Yui NARUSE <a href="mailto:naruse@airemix.jp" class="email">naruse@airemix.jp</a> wrote:</p>
<blockquote>
<blockquote>
<p> I guess "no" is the answer?</p>
</blockquote>
<p>default_internal doesn't effect on this situation.<br>
"#{a}" is considered as ` s = a.to_s<br>
So "no" is the answer, s's encoding depends a's encoding.</p>
<blockquote>
<p> What about "foo#{a}bar"? Would that have the same encoding result as<br>
"#{a}", or is the latter just a special case? (Either choice seems<br>
counterintuitive to me.)</p>
</blockquote>
<p>"foo#{a}bar" is considered as ` s = "foo"; s.concat(a.to_s); s.concat("bar").<br>
So the resulted s's encoding depends "foo".</p>
</blockquote>
<p>Helpful to know, thanks.</p>