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

System output with Terminal control codes such as U+001B causes error when parting XML #36

Open
ihancock opened this issue Apr 14, 2022 · 8 comments

Comments

@ihancock
Copy link

ihancock commented Apr 14, 2022

Our application uses Logger package which color codes log output. This introduces Unicode character code in the XML output which are not encoded into and XML entity.

See attached log file

@ihancock
Copy link
Author

log.txt

@rspilker
Copy link
Contributor

What version are you using? A recent version should have fixed some illegal Unicode in XML problems.

@ihancock
Copy link
Author

The version is 2.0.2 which I believe is the latest.

@dinwath
Copy link

dinwath commented May 12, 2022

I believe that the problem arises because control characters are invalid in XML 1.0 but allowed in XML 1.1, see this
wiki page and also this stackoverflow question

opened PR #39

@lazytesting
Copy link

I just ran into this as well as the azure devops report task is not willing to eat invalid xml, would be great if the PR of @dinwath could be merged

@lazytesting
Copy link

for reference: I quickly tested if moving the xml version to 1.1 would fix the issue I had in azure devops. Unfortunately it is not, seems that they do only support xml version 1.0. Not sure if that is something specifically on their end or something in the junit format.

@petrnymsa
Copy link

for reference: I quickly tested if moving the xml version to 1.1 would fix the issue I had in azure devops. Unfortunately it is not, seems that they do only support xml version 1.0. Not sure if that is something specifically on their end or something in the junit format.

@lazytesting Experiencing same issue with Azure devops, were you able solve it?

I've tried to "clean up" outputted XML file with some regex magic like

sed -Er -i'.bak' 's,\[34m|\[90m|\[31m|\[31m|\[0m|-\]|\[-,,g' TEST-report.xml

Basically, remove any escape characters, but they are apparently not all. So looking for some better solution.

@lazytesting
Copy link

For us it was only 1 character which gave the problem and this task solved it:

 - task: Bash@3
      displayName: "Fix test report"
      condition: always()
      inputs:
        targetType: 'inline'
        script: "sed 's/[]//g' -i test-report.xml"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants