Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/misc/allowed_chars.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ÄÖÜäöüß&*$% ':?,-(+.)/
4 changes: 3 additions & 1 deletion lib/sepa_king/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def convert(*attributes, options)
end

module InstanceMethods
ALLOWED_CHARS = Regexp.escape(File.read('lib/misc/allowed_chars.txt')).freeze

def convert_text(value)
return unless value

Expand All @@ -29,7 +31,7 @@ def convert_text(value)
gsub(/\n+/,' ').

# Remove all invalid characters
gsub(/[^a-zA-Z0-9ÄÖÜäöüß&*$%\ \'\:\?\,\-\(\+\.\)\/]/, '').
gsub(/[^#{ALLOWED_CHARS}]/, '').

# Remove leading and trailing spaces
strip
Expand Down