Defect #24616 » defect-24616.diff
| lib/redmine/codeset_util.rb (working copy) | ||
|---|---|---|
|
return str if str.nil?
|
||
|
str.force_encoding('UTF-8')
|
||
|
if ! str.valid_encoding?
|
||
|
str = str.encode("US-ASCII", :invalid => :replace,
|
||
|
:undef => :replace, :replace => '?').encode("UTF-8")
|
||
|
str = str.encode("UTF-8", :invalid => :replace,
|
||
|
:undef => :replace, :replace => '?')
|
||
|
end
|
||
|
str
|
||
|
end
|
||
| ... | ... | |
|
else
|
||
|
str.force_encoding("UTF-8")
|
||
|
if ! str.valid_encoding?
|
||
|
str = str.encode("US-ASCII", :invalid => :replace,
|
||
|
:undef => :replace, :replace => '?').encode("UTF-8")
|
||
|
str = str.encode("UTF-8", :invalid => :replace,
|
||
|
:undef => :replace, :replace => '?')
|
||
|
end
|
||
|
end
|
||
|
str
|
||
| test/unit/mail_handler_test.rb (working copy) | ||
|---|---|---|
|
assert_equal 'd8e8fca2dc0f896fd7cb4cb0031ba249', attachment.digest
|
||
|
end
|
||
|
def test_invalid_utf8
|
||
|
issue = submit_email(
|
||
|
'invalid_utf8.eml',
|
||
|
:issue => {:project => 'ecookbook'}
|
||
|
)
|
||
|
assert_kind_of Issue, issue
|
||
|
description = "\xD0\x97\xD0\xB4\xD1\x80\xD0\xB0\xD0\xB2\xD1\x81\xD1\x82\xD0\xB2\xD1\x83\xD0\xB9\xD1\x82\xD0\xB5?".force_encoding('UTF-8')
|
||
|
assert_equal description, issue.description
|
||
|
end
|
||
|
def test_gmail_with_attachment_ja
|
||
|
issue = submit_email(
|
||
|
'gmail_with_attachment_ja.eml',
|
||
- « Previous
- 1
- 2
- Next »