# Buggy code
def _extract_comment(self, comment, wordpress_namespace):
    """Extract comment from dump."""
    id = int(
        get_text_tag(comment, "{{{0}}}comment_id".format(wordpress_namespace), None)
    )
    author = get_text_tag(
        comment, "{{{0}}}comment_author".format(wordpress_namespace), None
    )
    author_email = get_text_tag(
        comment, "{{{0}}}comment_author_email".format(wordpress_namespace), None
    )
    author_url = get_text_tag(
        comment, "{{{0}}}comment_author_url".format(wordpress_namespace), None
    )
    author_IP = get_text_tag(
        comment, "{{{0}}}comment_author_IP".format(wordpress_namespace), None
    )
    # date = get_text_tag(comment, "{{{0}}}comment_date".format(wordpress_namespace), None)
    date_gmt = get_text_tag(
        comment, "{{{0}}}comment_date_gmt".format(wordpress_namespace), None
    )
    content = get_text_tag(
        comment, "{{{0}}}comment_content".format(wordpress_namespace), None
    )
    approved = get_text_tag(
        comment, "{{{0}}}comment_approved".format(wordpress_namespace), "0"
    )
    if approved == "0":
        approved = "hold"
    elif approved == "1":
        approved = "approved"
    elif approved == "spam" or approved == "trash":
        pass
    else:
        LOGGER.warn("Unknown comment approved status: " + str(approved))
    parent = int(
        get_text_tag(comment, "{{{0}}}comment_parent".format(wordpress_namespace), 0)
    )
    if parent == 0:
        parent = None
    user_id = int(
        get_text_tag(comment, "{{{0}}}comment_user_id".format(wordpress_namespace), 0)
    )
    if user_id == 0:
        user_id = None

    if approved == "trash" or approved == "spam":
        return None

    return {
        "id": id,
        "status": str(approved),
        "approved": approved == "approved",
        "author": author,
        "email": author_email,
        "url": author_url,
        "ip": author_IP,
        "date": date_gmt,
        "content": content,
        "parent": parent,
        "user_id": user_id,
    }


# Traceback (UnicodeEncodeError)
Traceback (most recent call last):
File "/path/lib/python2.7/site-packages/doit/doit_cmd.py", line 168, in run
return command.parse_execute(args)
File "/path/lib/python2.7/site-packages/doit/cmd_base.py", line 122, in parse_execute
return self.execute(params, args)
File "/path/lib/python2.7/site-packages/nikola/plugin_categories.py", line 127, in execute
return self._execute(options, args)
File "/path/lib/python2.7/site-packages/nikola/plugins/command/import_wordpress.py", line 325, in _execute
self.import_posts(channel)
File "/path/lib/python2.7/site-packages/nikola/plugins/command/import_wordpress.py", line 982, in import_posts
self.process_item_if_post_or_page(item)
File "/path/lib/python2.7/site-packages/nikola/plugins/command/import_wordpress.py", line 963, in process_item_if_post_or_page
out_folder_slug = self.import_postpage_item(item, wordpress_namespace, 'posts', attachments)
File "/path/lib/python2.7/site-packages/nikola/plugins/command/import_wordpress.py", line 916, in import_postpage_item
self._write_comment(os.path.join(self.output_folder, out_folder, comment_filename), comment)
File "/path/lib/python2.7/site-packages/nikola/plugins/command/import_wordpress.py", line 722, in _write_comment
write_header_line(fd, "author", comment["author"])
File "/path/lib/python2.7/site-packages/nikola/plugins/command/import_wordpress.py", line 714, in write_header_line
header_content = str(header_content).replace('\n', ' ')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 2: ordinal not in range(128)

# Fixed code
def _extract_comment(self, comment, wordpress_namespace):
    """Extract comment from dump."""
    id = int(
        get_text_tag(comment, "{{{0}}}comment_id".format(wordpress_namespace), None)
    )
    author = get_text_tag(
        comment, "{{{0}}}comment_author".format(wordpress_namespace), None
    )
    author_email = get_text_tag(
        comment, "{{{0}}}comment_author_email".format(wordpress_namespace), None
    )
    author_url = get_text_tag(
        comment, "{{{0}}}comment_author_url".format(wordpress_namespace), None
    )
    author_IP = get_text_tag(
        comment, "{{{0}}}comment_author_IP".format(wordpress_namespace), None
    )
    # date = get_text_tag(comment, "{{{0}}}comment_date".format(wordpress_namespace), None)
    date_gmt = get_text_tag(
        comment, "{{{0}}}comment_date_gmt".format(wordpress_namespace), None
    )
    content = get_text_tag(
        comment, "{{{0}}}comment_content".format(wordpress_namespace), None
    )
    approved = get_text_tag(
        comment, "{{{0}}}comment_approved".format(wordpress_namespace), "0"
    )
    if approved == "0":
        approved = "hold"
    elif approved == "1":
        approved = "approved"
    elif approved == "spam" or approved == "trash":
        pass
    else:
        LOGGER.warn("Unknown comment approved status: {0}".format(approved))
    parent = int(
        get_text_tag(comment, "{{{0}}}comment_parent".format(wordpress_namespace), 0)
    )
    if parent == 0:
        parent = None
    user_id = int(
        get_text_tag(comment, "{{{0}}}comment_user_id".format(wordpress_namespace), 0)
    )
    if user_id == 0:
        user_id = None

    if approved == "trash" or approved == "spam":
        return None

    return {
        "id": id,
        "status": str(approved),
        "approved": approved == "approved",
        "author": author,
        "email": author_email,
        "url": author_url,
        "ip": author_IP,
        "date": date_gmt,
        "content": content,
        "parent": parent,
        "user_id": user_id,
    }