The standard is for double quote (") to be encoded into " But golang seems to encode as the literal entity "
Last active
August 30, 2015 06:54
-
-
Save dragonfax/ca3ee45a0acf97820f58 to your computer and use it in GitHub Desktop.
golang oddity, XML encode encodes double quote wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/xml" | |
"os" | |
) | |
func main() { | |
type Person struct { | |
FirstName string `xml:"name>first"` | |
} | |
v := &Person{FirstName: `"John"`} | |
enc := xml.NewEncoder(os.Stdout) | |
enc.Encode(v) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Person><name><first>"John"</first></name></Person> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment