Project

General

Profile

Bug #1836

Can change encoding on frozen String

Added by candlerb (Brian Candler) about 11 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
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

Also available in: Atom PDF