diff --git a/homeassistant/util/yaml.py b/homeassistant/util/yaml.py index da97ed5662e..48d709bc549 100644 --- a/homeassistant/util/yaml.py +++ b/homeassistant/util/yaml.py @@ -78,7 +78,8 @@ def load_yaml(fname: str) -> Union[List, Dict]: def dump(_dict: dict) -> str: """Dump YAML to a string and remove null.""" - return yaml.safe_dump(_dict, default_flow_style=False) \ + return yaml.safe_dump( + _dict, default_flow_style=False, allow_unicode=True) \ .replace(': null\n', ':\n') diff --git a/tests/util/test_yaml.py b/tests/util/test_yaml.py index 50e271008a2..38b957ad102 100644 --- a/tests/util/test_yaml.py +++ b/tests/util/test_yaml.py @@ -267,6 +267,10 @@ class TestYaml(unittest.TestCase): """The that the dump method returns empty None values.""" assert yaml.dump({'a': None, 'b': 'b'}) == 'a:\nb: b\n' + def test_dump_unicode(self): + """The that the dump method returns empty None values.""" + assert yaml.dump({'a': None, 'b': 'привет'}) == 'a:\nb: привет\n' + FILES = {}