CoreOffice / XMLCoder

Easy XML parsing using Codable protocols in Swift
https://coreoffice.github.io/XMLCoder/
MIT License
800 stars 112 forks source link

" and " are not decoded equally #184

Closed owenzhao closed 4 years ago

owenzhao commented 4 years ago

In Xcode exported xliff file, there is an element Note, normally it will be like this.

<note>Class = "NSButtonCell"; title = "Cancel"; ObjectID = "0uT-sC-hK8";</note>

When decoded and encoded by XMLCoder, the above line would be

<note>Class = &quot;NSButtonCell&quot;; title = &quot;Cancel&quot;; ObjectID = &quot;0uT-sC-hK8&quot;;</note>

The above is OK. As both " and \" is accepted by Xcode. However, when decoding the above two elements to String, the String results are not equal.

For the one with ", the string value is

"Class = \"NSButtonCell\"; title = \"Cancel\"; ObjectID = \"0uT-sC-hK8\";"

For the one with \" the string value is

"Class =\"NSButtonCell\"; title =\"Cancel\"; ObjectID =\"0uT-sC-hK8\";"

Issue

When decoding with \" the "space" before " is wrongly ignored, which leads the two string values are not equal.

owenzhao commented 4 years ago

This issue is solved by set trimValueWhitespaces to false.