diff options
author | Ahmad Sherif <me@ahmadsherif.com> | 2018-03-22 23:22:20 +0300 |
---|---|---|
committer | Ahmad Sherif <me@ahmadsherif.com> | 2018-03-22 23:22:20 +0300 |
commit | 1f2cc29c8f703cedc03645bc365fda068f33a86b (patch) | |
tree | 2d37cf540932f9c675928f5d6ffe12e003f10445 /spec/lib/gitlab/encoding_helper_spec.rb | |
parent | 5c36e1b96a7c159a3f8a71528b14cc1c726a8bb9 (diff) |
Fix EncodingHelper#clean blowing up on UTF-16BE strings
Closes gitaly#1101
Diffstat (limited to 'spec/lib/gitlab/encoding_helper_spec.rb')
-rw-r--r-- | spec/lib/gitlab/encoding_helper_spec.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/lib/gitlab/encoding_helper_spec.rb b/spec/lib/gitlab/encoding_helper_spec.rb index 83d431a7458..e68c9850f6b 100644 --- a/spec/lib/gitlab/encoding_helper_spec.rb +++ b/spec/lib/gitlab/encoding_helper_spec.rb @@ -161,6 +161,11 @@ describe Gitlab::EncodingHelper do 'removes invalid bytes from ASCII-8bit encoded multibyte string.', "Lorem ipsum\xC3\n dolor sit amet, xy\xC3\xA0y\xC3\xB9abcd\xC3\xB9efg".force_encoding('ASCII-8BIT'), "Lorem ipsum\n dolor sit amet, xyàyùabcdùefg" + ], + [ + 'handles UTF-16BE encoded strings', + "\xFE\xFF\x00\x41".force_encoding('ASCII-8BIT'), # An "A" prepended with UTF-16 BOM + "\xEF\xBB\xBFA" # An "A" prepended with UTF-8 BOM ] ].each do |description, test_string, xpect| it description do |