Response BodyAsString loses BodyData.Encoding when UseTransformer = true #265

Closed
opened 2025-12-29 15:19:23 +01:00 by adam · 3 comments
Owner

Originally created by @coxstl on GitHub (Apr 28, 2020).

Originally assigned to: @StefH on GitHub.

I am mocking WCF soap messages with WireMock. I am also using Unicode encoding. When I set UseTransformer to true, I get "The encoding in the declaration 'utf-16' does not match the encoding of the document 'utf-8'." When I set the Encoding = original.BodyData.Encoding in the ResponseMessageTransformer.TransformBodyAsString, the error goes away. Can you add that line to that file? It would help other people who still have to work with WCF projects.

Originally created by @coxstl on GitHub (Apr 28, 2020). Originally assigned to: @StefH on GitHub. I am mocking WCF soap messages with WireMock. I am also using Unicode encoding. When I set UseTransformer to true, I get "The encoding in the declaration 'utf-16' does not match the encoding of the document 'utf-8'." When I set the Encoding = original.BodyData.Encoding in the ResponseMessageTransformer.TransformBodyAsString, the error goes away. Can you add that line to that file? It would help other people who still have to work with WCF projects.
adam added the bug label 2025-12-29 15:19:23 +01:00
adam closed this issue 2025-12-29 15:19:23 +01:00
Author
Owner

@StefH commented on GitHub (Apr 28, 2020):

Can you try MyGet version WireMock.Net.1.2.5-ci-13242.nupkg?

@StefH commented on GitHub (Apr 28, 2020): Can you try MyGet version WireMock.Net.1.2.5-ci-13242.nupkg?
Author
Owner

@coxstl commented on GitHub (Apr 29, 2020):

That worked like a charm. Thank you.

@coxstl commented on GitHub (Apr 29, 2020): That worked like a charm. Thank you.
Author
Owner

@StefH commented on GitHub (Apr 29, 2020):

Official version 1.2.6 is released

@StefH commented on GitHub (Apr 29, 2020): Official version 1.2.6 is released
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#265