Fixed issue #2722 - mail processing impossible: invalid byte sequence in UTF-8.
This commit is contained in:
parent
d57ac5338e
commit
7f1d30e089
2 changed files with 14 additions and 0 deletions
|
@ -284,6 +284,7 @@ class String
|
|||
chr_orig
|
||||
end
|
||||
end
|
||||
string = string.utf8_encode(fallback: :read_as_sanitized_binary)
|
||||
|
||||
# remove tailing empty spaces
|
||||
string.gsub!(/[[:blank:]]+$/, '')
|
||||
|
|
|
@ -542,6 +542,18 @@ RSpec.describe String do
|
|||
TEXT
|
||||
end
|
||||
|
||||
context 'html encoding' do
|
||||
it 'converts Ä in Ä' do
|
||||
expect('<div>test something.Ä</div>'.html2text)
|
||||
.to eq('test something.Ä')
|
||||
end
|
||||
|
||||
it 'strips invalid html encoding chars' do
|
||||
expect('<div>test something.�</div>'.html2text)
|
||||
.to eq('test something.í ˝')
|
||||
end
|
||||
end
|
||||
|
||||
context 'performance tests' do
|
||||
let(:filler) do
|
||||
%(<p>some word <a href="http://example.com?domain?example.com">some url</a> and the end.</p>\n) * 11 + "\n"
|
||||
|
@ -574,6 +586,7 @@ RSpec.describe String do
|
|||
</html>
|
||||
HTML
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue