Actions
Defect #24616
closedShould not replace all invalid utf8 characters (e.g in mail)
Defect #24616:
Should not replace all invalid utf8 characters (e.g in mail)
Resolution:
Fixed
Affected version:
Description
Hello,
I've an email, that is encoded in utf8, but it contains an invalid character. In this case, redmine converts the content to us-ascii and then to utf8. This step will replace non-ascii compatible chars to "?". Why?
1) Failure: MailHandlerTest#test_invalid_utf8 [/test/unit/mail_handler_test.rb:548]: Expected: "Здравствуйте?" Actual: "?????????????"
I changed Redmine::CodesetUtil.replace_invalid_utf8(str) and Redmine::CodesetUtil.to_utf8(str, encoding)
str = str.encode("US-ASCII", :invalid => :replace, :undef => :replace, :replace => '?').encode("UTF-8")
to
all tests are passing with this change.
Files
Actions