On Wed, Sep 7, 2011 at 12:20 AM, Adam Prescott adam@aprescott.com wrote:
Since "#{a}" is actually a new string, doesn't it make sense that its
encoding should be the default internal encoding? I can see "#{a}" being
used with the encoding change actually expected.
I guess "no" is the answer?
What about "foo#{a}bar"? Would that have the same encoding result as
"#{a}", or is the latter just a special case? (Either choice seems
counterintuitive to me.)
On Wed, Sep 7, 2011 at 12:20 AM, Adam Prescott adam@aprescott.com wrote:
Since "#{a}" is actually a new string, doesn't it make sense that its
encoding should be the default internal encoding? I can see "#{a}" being
used with the encoding change actually expected.
I guess "no" is the answer?
default_internal doesn't effect on this situation.
"#{a}" is considered as ` s = a.to_s
So "no" is the answer, s's encoding depends a's encoding.
What about "foo#{a}bar"? Would that have the same encoding result as
"#{a}", or is the latter just a special case? (Either choice seems
counterintuitive to me.)
"foo#{a}bar" is considered as ` s = "foo"; s.concat(a.to_s); s.concat("bar").
So the resulted s's encoding depends "foo".
default_internal doesn't effect on this situation.
"#{a}" is considered as ` s = a.to_s
So "no" is the answer, s's encoding depends a's encoding.
What about "foo#{a}bar"? Would that have the same encoding result as
"#{a}", or is the latter just a special case? (Either choice seems
counterintuitive to me.)
"foo#{a}bar" is considered as ` s = "foo"; s.concat(a.to_s); s.concat("bar").
So the resulted s's encoding depends "foo".