# Importing mbox files fails at creating topics with Chinese characters due to invalid byte sequence

**URL:** <https://meta.discourse.org/t/importing-mbox-files-fails-at-creating-topics-with-chinese-characters-due-to-invalid-byte-sequence/62889>\
**Category:** Bug\
**Created:** [Mai 17, 2017, 4:27 UTC](https://meta.discourse.org/t/importing-mbox-files-fails-at-creating-topics-with-chinese-characters-due-to-invalid-byte-sequence/62889 "2017-05-17T16:27:34Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![yanokwa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yanokwa/32/105083_2.png) [@yanokwa](https://meta.discourse.org/u/yanokwa)\
**Post date:** [Mai 17, 2017, 4:27 UTC](https://meta.discourse.org/t/importing-mbox-files-fails-at-creating-topics-with-chinese-characters-due-to-invalid-byte-sequence/62889/1 "2017-05-17T16:27:34Z")

</div>

I am using Discourse v1.8.0.beta12 +34 and I’ve used [Icy’s Google Group Crawler](https://github.com/icy/google-group-crawler) to generate mboxes of the various Google Groups I’m importing into Discourse. I’ve successfully imported a couple of groups, but I’ve run into an issue where the script errors with this message.

```plaintext
creating forum topics
     1359 / 5133 ( 26.5%) [53 items/min] /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/core_ext/object/blank.rb:24:in `blank?': invalid byte sequence in UTF-8 (ArgumentError)
	from /usr/local/lib/ruby/gems/2.3.0/gems/activesupport-4.2.8/lib/active_support/core_ext/object/blank.rb:24:in `present?'
	from /var/www/discourse/lib/email/receiver.rb:238:in `try_to_encode'
	from /var/www/discourse/lib/email/receiver.rb:229:in `block in fix_charset'
	from /var/www/discourse/lib/email/receiver.rb:228:in `each'
	from /var/www/discourse/lib/email/receiver.rb:228:in `fix_charset'
	from /var/www/discourse/lib/email/receiver.rb:184:in `select_body'
	from mbox.rb:426:in `block (2 levels) in create_forum_topics'
	from /var/www/discourse/script/import_scripts/base.rb:432:in `block in create_posts'
	from /var/www/discourse/script/import_scripts/base.rb:431:in `each'
	from /var/www/discourse/script/import_scripts/base.rb:431:in `create_posts'
	from mbox.rb:419:in `block in create_forum_topics'
	from /var/www/discourse/script/import_scripts/base.rb:784:in `block in batches'
	from /var/www/discourse/script/import_scripts/base.rb:783:in `loop'
	from /var/www/discourse/script/import_scripts/base.rb:783:in `batches'
	from mbox.rb:413:in `create_forum_topics'
	from mbox.rb:57:in `execute'
	from /var/www/discourse/script/import_scripts/base.rb:45:in `perform'
	from mbox.rb:555:in `<top (required)>'
	from googlegroup.rb:51:in `load'
	from googlegroup.rb:51:in `import_to_discourse'
	from googlegroup.rb:73:in `<main>'

```

I know this isn’t the most useful bug report and I’d love the community’s help in making it more useful. My guess is that there is some Unicode character that is the problem, but I don’t have a good idea on how I output what topic or mbox file is causing the problem…

---

_[View the full topic](https://meta.discourse.org/t/importing-mbox-files-fails-at-creating-topics-with-chinese-characters-due-to-invalid-byte-sequence/62889)._
