summaryrefslogtreecommitdiff
path: root/lib/gitlab/unicode.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/unicode.rb')
-rw-r--r--lib/gitlab/unicode.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/gitlab/unicode.rb b/lib/gitlab/unicode.rb
new file mode 100644
index 00000000000..b49c5647dab
--- /dev/null
+++ b/lib/gitlab/unicode.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+module Gitlab
+ class Unicode
+ # Regular expression for identifying bidirectional control
+ # characters in UTF-8 strings
+ #
+ # Documentation on how this works:
+ # https://idiosyncratic-ruby.com/41-proper-unicoding.html
+ BIDI_REGEXP = /\p{Bidi Control}/.freeze
+
+ class << self
+ # Warning message used to highlight bidi characters in the GUI
+ def bidi_warning
+ _("Potentially unwanted character detected: Unicode BiDi Control")
+ end
+ end
+ end
+end