# Buggy code
def update_stats_history(self):
    """Update stats history."""
    # If the plugin data is a dict, the dict's key should be used
    if self.get_key() is None:
        item_name = ""
    else:
        item_name = self.get_key()
    # Build the history
    if self.get_export() and self._history_enable():
        for i in self.get_items_history_list():
            if isinstance(self.get_export(), list):
                # Stats is a list of data
                # Iter throught it (for exemple, iter throught network
                # interface)
                for l in self.get_export():
                    self.stats_history.add(
                        str(l[item_name]) + "_" + i["name"],
                        l[i["name"]],
                        description=i["description"],
                        history_max_size=self._limits["history_size"],
                    )
            else:
                # Stats is not a list
                # Add the item to the history directly
                self.stats_history.add(
                    i["name"],
                    self.get_export()[i["name"]],
                    description=i["description"],
                    history_max_size=self._limits["history_size"],
                )


# Traceback (UnicodeEncodeError)
╭─rain@pegasus ~
╰─$ glances
Traceback (most recent call last):
File "/usr/local/bin/glances", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/glances/__init__.py", line 140, in main
start(config=config, args=args)
File "/usr/local/lib/python2.7/dist-packages/glances/__init__.py", line 106, in start
mode = GlancesMode(config=config, args=args)
File "/usr/local/lib/python2.7/dist-packages/glances/standalone.py", line 73, in __init__
self.stats.update()
File "/usr/local/lib/python2.7/dist-packages/glances/stats.py", line 224, in update
self._plugins[p].update_stats_history()
File "/usr/local/lib/python2.7/dist-packages/glances/plugins/glances_plugin.py", line 185, in update_stats_history
str(l[item_name]) + '_' + i['name'],
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfd' in position 15: ordinal not in range(128)
╭─rain@pegasus ~
╰─$                                                                                                                                1 ↵

# Fixed code
def update_stats_history(self):
    """Update stats history."""
    # If the plugin data is a dict, the dict's key should be used
    if self.get_key() is None:
        item_name = ""
    else:
        item_name = self.get_key()
    # Build the history
    if self.get_export() and self._history_enable():
        for i in self.get_items_history_list():
            if isinstance(self.get_export(), list):
                # Stats is a list of data
                # Iter throught it (for exemple, iter throught network
                # interface)
                for l in self.get_export():
                    self.stats_history.add(
                        nativestr(l[item_name]) + "_" + nativestr(i["name"]),
                        l[i["name"]],
                        description=i["description"],
                        history_max_size=self._limits["history_size"],
                    )
            else:
                # Stats is not a list
                # Add the item to the history directly
                self.stats_history.add(
                    nativestr(i["name"]),
                    self.get_export()[i["name"]],
                    description=i["description"],
                    history_max_size=self._limits["history_size"],
                )