Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
encoding/asn1: UTF8String being unmarshalled as PrintableString and failing #8541
> What does 'go version' print? go version go1.3 linux/amd64 > What steps reproduce the problem? Attempt to unmarshal a string with non-PrintableString characters in a field with a context-specific tag and no EXPLICIT: http://play.golang.org/p/5bGjMTiq93 > What happened? The Broken case returns an error. > What should have happened instead? Both cases should work. Most unexpected, note that the "utf8" parameter has no effect when "tag:1" is present. Adding "explicit" makes Broken work. Looking at the marshalling output, the Works does properly produce a UTF8String. I think the problem is that the switch in https://code.google.com/p/go/source/browse/src/pkg/encoding/asn1/asn1.go?name=go1.3.1#798 is seeing tagPrintableString because https://code.google.com/p/go/source/browse/src/pkg/encoding/asn1/asn1.go?name=go1.3.1#643 doesn't match in the case of non-universal tags. I see no reference to param.stringType in the unmarshaller, which is an indication this code does not handle the (non-explicit) context-specific tags case. I propose the following patch, falling back to using param.stringType if the on-wire tag doesn't provide a clue.