[GH-ISSUE #989] Response XML formatting tab doesn't work when response charset is not UTF-8 #984

Open
opened 2026-03-03 19:23:32 +03:00 by kerem · 3 comments
Owner

Originally created by @Bertrand on GitHub (Sep 10, 2021).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/989

Originally assigned to: @NghiaTranUIT on GitHub.

Description

When inspecting XML responses encoded in ISO-8859-1 charset (and probably any encoding other than UTF-8) , the XML formatting tab displays "Invalid XML Data" instead of the actual XML Data.

This happens even tough the content-type header properly specifies the response charset:

Content-Type: text/xml;charset=ISO-8859-1

Possible root cause

The charset parameter in the content-type HTTP response header is probably ignored and the response is wrongly interpreted as UTF-8.

Proxyman version

Version 2.32.1 (23210)

macOS Version

mac 11.5.2

Steps to reproduce

The attached test-charset.tar.gz archive contains one UTF-8-encoded XML file and one ISO-8859-1-encoded xml file.

It also contains a simple node project that uses the serve npm module that creates a local http server serving the two files with their correct charset set in the content-type header.

  • Install node.js on your local computer.
  • Download the following node project: test-charset.tar.gz
  • Untar the archive:
tar xfz ./test-charset.tar.gz
  • Install node dependencies (the serve npm module, actually)
npm install
  • Launch the local web server
npx serve
  • Launch proxyman
  • In another terminal, run the following two commands:
curl --proxy "http://localhost:9090"  http://0.0.0.0:5000/response.xml
curl --proxy "http://localhost:9090"  http://0.0.0.0:5000/response.ISO-8859-1.xml
  • Kill the server command
  • Open the corresponding responses in proxyman

Observed behavior

  • The xml response tab correctly formats for the response.xml request
  • The xml response tab displays "Invalid XML Data" for the response.ISO-8859-1.xml instead of the actual data 🚫

Expected behavior

Both XML responses should be formatted correcly

Originally created by @Bertrand on GitHub (Sep 10, 2021). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/989 Originally assigned to: @NghiaTranUIT on GitHub. ### Description When inspecting XML responses encoded in `ISO-8859-1` charset (and probably any encoding other than UTF-8) , the XML formatting tab displays "Invalid XML Data" instead of the actual XML Data. This happens even tough the `content-type` header properly specifies the response charset: ``` Content-Type: text/xml;charset=ISO-8859-1 ``` ### Possible root cause The `charset` parameter in the `content-type` HTTP response header is probably ignored and the response is wrongly interpreted as UTF-8. ### Proxyman version Version 2.32.1 (23210) ### macOS Version mac 11.5.2 ### Steps to reproduce The attached `test-charset.tar.gz` archive contains one `UTF-8`-encoded XML file and one `ISO-8859-1`-encoded xml file. It also contains a simple node project that uses the `serve` npm module that creates a local http server serving the two files with their correct charset set in the `content-type` header. - Install node.js on your local computer. - Download the following node project: [test-charset.tar.gz](https://github.com/ProxymanApp/Proxyman/files/7142494/test-charset.tar.gz) - Untar the archive: ``` tar xfz ./test-charset.tar.gz ``` - Install node dependencies (the `serve` npm module, actually) ``` npm install ``` - Launch the local web server ``` npx serve ``` - Launch proxyman - In another terminal, run the following two commands: ``` curl --proxy "http://localhost:9090" http://0.0.0.0:5000/response.xml curl --proxy "http://localhost:9090" http://0.0.0.0:5000/response.ISO-8859-1.xml ``` - Kill the `server` command - Open the corresponding responses in proxyman ### Observed behavior - The xml response tab correctly formats for the `response.xml` request ✅ - The xml response tab displays "Invalid XML Data" for the `response.ISO-8859-1.xml` instead of the actual data 🚫 ### Expected behavior Both XML responses should be formatted correcly
Author
Owner

@NghiaTranUIT commented on GitHub (Sep 10, 2021):

It's definitely a bug because Proxyman hasn't supported ISO-8859-1 charset parsing the XML 😄

To workaround, I recommend previewing the XML file on the Body Tab.

Let me fix and send you a Beta build soon 👍

<!-- gh-comment-id:916807054 --> @NghiaTranUIT commented on GitHub (Sep 10, 2021): It's definitely a bug because Proxyman hasn't supported ISO-8859-1 charset parsing the XML 😄 To workaround, I recommend previewing the XML file on the Body Tab. Let me fix and send you a Beta build soon 👍
Author
Owner

@NghiaTranUIT commented on GitHub (Sep 10, 2021):

Hey @Bertrand please check out this beta build: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_2.32.1_Fix_Charset.dmg

From now, Proxyman will get a charset in ContentType and try to parse it properly. Otherwise, it will "guess" 👍

Screen Shot 2021-09-10 at 21 48 47
<!-- gh-comment-id:916990554 --> @NghiaTranUIT commented on GitHub (Sep 10, 2021): Hey @Bertrand please check out this beta build: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_2.32.1_Fix_Charset.dmg From now, Proxyman will get a charset in ContentType and try to parse it properly. Otherwise, it will "guess" 👍 <img width="1831" alt="Screen Shot 2021-09-10 at 21 48 47" src="https://user-images.githubusercontent.com/5878421/132878300-03e41672-102a-45fb-b1ac-396c0ec291e7.png">
Author
Owner

@Bertrand commented on GitHub (Sep 13, 2021):

Hey @NghiaTranUIT, it works like a charm now 😃 😃
Many thanks !!!

<!-- gh-comment-id:917920315 --> @Bertrand commented on GitHub (Sep 13, 2021): Hey @NghiaTranUIT, it works like a charm now 😃 😃 Many thanks !!!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#984
No description provided.