From cb8fa4697024ed70620d362aca21b34cd6ec29ff Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Sun, 22 Sep 2019 05:18:48 -0700 Subject: [PATCH] DEV: prevents populate task to crash (#8111) Generated emails/names/sentences were crashing with the following error: ``` Can not transliterate strings with ASCII-8BIT encoding ``` --- lib/tasks/populate.thor | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/tasks/populate.thor b/lib/tasks/populate.thor index 3aa40e3399d..50087729f86 100644 --- a/lib/tasks/populate.thor +++ b/lib/tasks/populate.thor @@ -102,11 +102,13 @@ class Populate < Thor end def generate_sentence(num_words) - hipster_words.sample(num_words).join(' ').capitalize + '.' + sentence = hipster_words.sample(num_words).join(' ').capitalize + '.' + sentence.force_encoding('UTF-8') end def generate_email - hipster_words.sample.delete(' ') + '@' + hipster_words.sample.delete(' ') + '.com' + email = hipster_words.sample.delete(' ') + '@' + hipster_words.sample.delete(' ') + '.com' + email.delete("'").force_encoding('UTF-8') end def image_posts