On Windows, the default file system encoding is 'mbcs'
resulting in a bad conversion.

To make it cross-platform tolerant use
'sys.getfilesystemencoding()' instead of 'utf-8'.


Co-authored-by: Alin Serdean <aserd...@cloudbasesolutions.com>
Signed-off-by: Alin Balutoiu <abalut...@cloudbasesolutions.com>
Signed-off-by: Alin Serdean <aserd...@cloudbasesolutions.com>
---
 tests/test-ovsdb.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/test-ovsdb.py b/tests/test-ovsdb.py
index df9d6d5..fc42a2d 100644
--- a/tests/test-ovsdb.py
+++ b/tests/test-ovsdb.py
@@ -337,7 +337,8 @@ def idl_set(idl, commands, step):
                 if six.PY2:
                     s.s = args[2].decode('utf-8')
                 else:
-                    s.s = args[2].encode('utf-8', 'surrogateescape') \
+                    s.s = args[2].encode(sys.getfilesystemencoding(),
+                                         'surrogateescape') \
                                  .decode('utf-8', 'replace')
             elif args[1] == "u":
                 s.u = uuid.UUID(args[2])
-- 
2.10.0.windows.1
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to