aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2015-06-04 17:56:44 +0100
committerLouise Crow <louise.crow@gmail.com>2015-06-22 17:43:09 +0100
commit910acfa8ae939f363a872123eb47a86e64a192c3 (patch)
treec0e7e0283cc191be7905ac1c5b5f58f4074842c4 /lib
parent3efe2f333a9b143e88556c0aeedb534090eb41d3 (diff)
Use ASCII-8BIT for replacement patterns when handling binary data.
Also be explicit about using UTF-8 when handling text data.
Diffstat (limited to 'lib')
-rw-r--r--lib/alaveteli_text_masker.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/alaveteli_text_masker.rb b/lib/alaveteli_text_masker.rb
index 3c2bcf825..5ec7aa95c 100644
--- a/lib/alaveteli_text_masker.rb
+++ b/lib/alaveteli_text_masker.rb
@@ -79,7 +79,7 @@ module AlaveteliTextMasker
# Replace text in place
def apply_binary_masks!(text, options = {})
# Keep original size, so can check haven't resized it
- orig_size = text.mb_chars.size
+ orig_size = text.size
# Replace ASCII email addresses...
text.gsub!(MySociety::Validate.email_find_regexp) do |email|
@@ -114,7 +114,7 @@ module AlaveteliTextMasker
# Replace censor items
censor_rules = options[:censor_rules] || []
censor_rules.each{ |censor_rule| censor_rule.apply_to_binary!(text) }
- raise "internal error in apply_binary_masks!" if text.mb_chars.size != orig_size
+ raise "internal error in apply_binary_masks!" if text.size != orig_size
return text
end