Hello.

When preparing for immutable strings by default, I changed my code from

    buffer = ""

to

    buffer = String.new

However, an unintended side effect of this was the encoding:

2.3.1 :001 > "".encoding
 => #<Encoding:UTF-8>
2.3.1 :002 > String.new.encoding
 => #<Encoding:ASCII-8BIT>

I'm replacing `""` with `String.new(encoding: Encoding::UTF_8)` but
wondering what exactly is the best practice here going forward?

Kind regards,
Samuel

Unsubscribe: <mailto:ruby-talk-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>