We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hey,
I'd like to contribute two changes upstream but, before I do, I wanted to get your thoughts on if you think you'd accept the changes.
Change #1 - Preserve Whitespace
I'd like to update https://github.com/basgys/goxml2json/blob/master/decoder.go#L136 to not trim white space. I was thinking, to preserve backwards-compatibility I do the following:
trimNonGraphic
*Decoder
Decoder
doNotTrimWhitespace
SetDoNotTrimWhitespace
Change #2 - Customize encoding string sanitization
According to the accepted answer of https://stackoverflow.com/questions/3020094/how-should-i-escape-strings-in-json the only characters we must escape is \, ", and control codes (U+0020 and below). The library currently also escapes <, >, and &. I have an application that needs & to remain unescaped. I was hoping we could allow for users to customize which characters are escaped while retaining backwards-compatibility with the following changes to https://github.com/basgys/goxml2json/blob/master/encoder.go:
\
"
<
>
&
charactersToEscape
<>&
b
sanitiseString
*Encoder
Thoughts? With the changes everything would remain the same (by default) but still allow for folks to customize things as needed.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hey,
I'd like to contribute two changes upstream but, before I do, I wanted to get your thoughts on if you think you'd accept the changes.
Change #1 - Preserve Whitespace
I'd like to update https://github.com/basgys/goxml2json/blob/master/decoder.go#L136 to not trim white space. I was thinking, to preserve backwards-compatibility I do the following:
trimNonGraphic
to be a function receiver of*Decoder
Decoder
to have adoNotTrimWhitespace
propertySetDoNotTrimWhitespace
*Decoder` function receiverChange #2 - Customize encoding string sanitization
According to the accepted answer of https://stackoverflow.com/questions/3020094/how-should-i-escape-strings-in-json the only characters we must escape is
\
,"
, and control codes (U+0020 and below). The library currently also escapes<
,>
, and&
. I have an application that needs&
to remain unescaped. I was hoping we could allow for users to customize which characters are escaped while retaining backwards-compatibility with the following changes to https://github.com/basgys/goxml2json/blob/master/encoder.go:charactersToEscape
property. If not set, default to<>&
<
,>
, and&
specifically and instead check if theb
character is contained within the encoder'scharactersToEscape
. Would also require updatingsanitiseString
to be a function receiver of*Encoder
.Thoughts? With the changes everything would remain the same (by default) but still allow for folks to customize things as needed.
The text was updated successfully, but these errors were encountered: