Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/encoding #1245

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ If you have installed pip then run::
pip install zeep

Note that the latest version to support Python 2.7 and Python 3.5 is Zeep 4.0,
install via pip install zeep==4.0.0
install via pip install zeep==3.4.0

This assumes that there are wheel files available for the latest lxml release.
If that is not the case (https://pypi.python.org/pypi/lxml/) then first
Expand Down
3 changes: 2 additions & 1 deletion src/zeep/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def resolve(self, url, pubid, context):
return self.resolve_string(content, context)


def parse_xml(content: str, transport, base_url=None, settings=None):
def parse_xml(content: str, transport, base_url=None, settings=None, encoding="utf-8"):
"""Parse an XML string and return the root Element.

:param content: The XML string
Expand All @@ -44,6 +44,7 @@ def parse_xml(content: str, transport, base_url=None, settings=None):
resolve_entities=False,
recover=recover,
huge_tree=settings.xml_huge_tree,
encoding=encoding,
)
parser.resolvers.add(ImportResolver(transport))
try:
Expand Down
2 changes: 1 addition & 1 deletion src/zeep/wsdl/bindings/soap.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def process_reply(self, client, operation, response):
content = response.content

try:
doc = parse_xml(content, self.transport, settings=client.settings)
doc = parse_xml(content, self.transport, settings=client.settings, encoding=response.encoding)
except XMLSyntaxError as exc:
raise TransportError(
"Server returned response (%s) with invalid XML: %s.\nContent: %r"
Expand Down