Actions
Defect #24616
closedShould not replace all invalid utf8 characters (e.g in mail)
Start date:
Due date:
% Done:
0%
Estimated time:
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
str = str.encode("UTF-8", :invalid => :replace, :undef => :replace, :replace => '?')
all tests are passing with this change.
Redmine version 3.3.1.stable Ruby version 2.1.5-p273 (2014-11-13) [x64-mingw32] Rails version 4.2.7.1 Environment production Database adapter Mysql2 SCM: Git 2.10.1 Filesystem Redmine plugins: no plugin installed
Files
Actions