Skip to content
New issue

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

Use of Fprintf in the NewWriter example #12

Open
GoogleCodeExporter opened this issue Sep 2, 2015 · 0 comments
Open

Use of Fprintf in the NewWriter example #12

GoogleCodeExporter opened this issue Sep 2, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

If you use the example for the NewWriter provided in the docs and the string 
contains a '%', the % is used as a format string, because the signature of 
Fprintf is:

Fprintf(w io.Writer, format string, a ...interface{}) (n int, err error)

See:

https://code.google.com/p/go-charset/source/browse/charset/example_test.go#32

What is the expected output? What do you see instead?

If I want to convert e.g. the string '100% free', I get: 100%!f(MISSING)ree.

If I use fmt.Fprint(w, s) instead of fmt.Fprintf(w, s), the result is correct. 
I think, the docs / the example should be updated.

Original issue reported on code.google.com by michael....@googlemail.com on 11 Nov 2014 at 2:42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant