Forum: Ruby-core [ruby-trunk - Bug #8123][Open] Transcoding exception when using replace along with universal_newline

Posted by Kieran Pilkington (k776)
on 2013-03-19 05:53
(Received via mailing list)
Issue #8123 has been reported by k776 (Kieran P).

----------------------------------------
Bug #8123: Transcoding exception when using replace along with 
universal_newline
https://bugs.ruby-lang.org/issues/8123

Author: k776 (Kieran P)
Status: Open
Priority: Normal
Assignee:
Category:
Target version:
ruby -v: 1.9.3 and 2.0.0


The following can be reproduced on 1.9.3-p385, 1.9.3-p392, and 2.0.0-p0.

  body, charset = "hey", "hey".encoding.to_s
  body = body.encode('UTF-8', charset,
    :invalid => :replace, :undef => :replace,
    :replace => '', :universal_newline => true
  )
  Encoding::ConverterNotFoundError: code converter not found 
(universal_newline)

However, if you remove ":replace => '', ", then it works as intended.

Seems you can't use the two options together.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.