Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/encoding_helper.rb')
-rw-r--r--lib/gitlab/encoding_helper.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/gitlab/encoding_helper.rb b/lib/gitlab/encoding_helper.rb
index b1fd35184ac..99240f2ad48 100644
--- a/lib/gitlab/encoding_helper.rb
+++ b/lib/gitlab/encoding_helper.rb
@@ -16,6 +16,7 @@ module Gitlab
ENCODING_CONFIDENCE_THRESHOLD = 50
UNICODE_REPLACEMENT_CHARACTER = "�"
+ BOM_UTF8 = "\xEF\xBB\xBF"
def encode!(message)
message = force_encode_utf8(message)
@@ -147,6 +148,10 @@ module Gitlab
filename.force_encoding("UTF-8")
end
+ def strip_bom(message)
+ message.delete_prefix(BOM_UTF8)
+ end
+
private
def force_encode_utf8(message)