I encountered a special character issue with my REST POST payload (request body). As request, the payload include other characters, like Simplified (测试) / Traditional(測試) Chinese. after save project, the test case will be missing due to invalid xml. I open it with XML Spy and said there are invalid characters (acutally it's mass code becoz of special characters). If I accept XML spy convertion, then this xml would be imported into ReadyAPI.
I search the same issue from forum, but seems did not find a solution. Checked the encoding, it's UTF-8 in header of xml.
Content-type of my payload is application/json, appreciated if anyone who would provide available solution for that.
Solved! Go to Solution.
I had a similar problem with the ISO-8859-1 charset. My testdata file included chars that weren't included within the UTR-8 charset - meaning that the project.xml file was no longer wellformed relative to the defined character set, meaning that the project.xml file couldn't be opened in REadyAPI! as ReadyAPI! requires the project.xml file to be wellformed....well - if you read certain literature - it states that XML isn't even XML until its wellformed!
anway - to 'fix' it I had to open the malformed .xml file within an app that didnt include an XML parser (something like notepad++) and then replace the substitution characters with a char that was contained within both ISO-8859-1 and UTF-8. When I tried using XMLSpy (app that contains an XML parser) I couldn't alter the substitution characters - hence the reason I had to use an app without an XML parser.
I had a quick look at I've found contradictory info as to whether UTF-8 supports chinese characters - but it appears UTF-16 and UTF-32 does, so to ensure this doesnt occur again - you could always adopt the approach @nmrao suggested and update your file.encoding attribute in ReadyAPI!'s system properties from whatever it is (displayed in the system properties, file.encoding attribute value) but rather than change to UTF-8 - change to UTF-16 or 32 instead?
oh - one thing - UTF-8 is the default char encoding within .xml. you can set it to other charsets - its just UTF-8 is the default one.
grabbed the following from stackoverflow
Ok - this is a bit weird - my system properties 'file.encoding' attribute value is set as 'Cp1252'. HOWEVER - if I look in the ready-api.bat file - the encoding value is set as 'iso-8859-1'
Confused.....I would expect them to be identical!
yay! all good then fella!