Project

General

Profile

Actions

Bug #1836

closed

Can change encoding on frozen String

Added by candlerb (Brian Candler) over 14 years ago. Updated almost 13 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.2dev (2009-07-18 trunk 24186) [i686-linux]
Backport:
[ruby-core:24609]

Description

=begin
String#encode! lets you change the encoding on a frozen String, as long as the character sequence is unchanged by the operation.

s = "hello"
=> "hello"
s.freeze
=> "hello"
s.encode!("ISO-8859-1")
=> "hello"
s.encoding
=> #Encoding:ISO-8859-1

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0