Skip to content
Permalink
Browse files

Do not encode py3 strings to utf-8 again. Compat.unicode matches stri…

…ngs and unicode in py3.
  • Loading branch information...
xschlef committed Jul 18, 2019
1 parent ad2b80f commit cc24e9e2635974a3c7521b660d4f72fd8db26661
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/lib/Bcfg2/Server/Plugins/Probes.py
@@ -307,7 +307,8 @@ class ProbeData(str): # pylint: disable=E0012,R0924
.json, and .yaml properties to provide convenient ways to use
ProbeData objects as XML, JSON, or YAML data """
def __new__(cls, data):
if isinstance(data, unicode):
# prevent double encoding utf-8 in python3
if isinstance(data, unicode) and not isinstance(data, str):
return str.__new__(cls, data.encode('utf-8'))
else:
return str.__new__(cls, data)

0 comments on commit cc24e9e

Please sign in to comment.
You can’t perform that action at this time.