Re: [go-nuts] casting slice of rune to string picks up extra characters for some inputs

2017-02-28 Thread Ian Lance Taylor
On Tue, Feb 28, 2017 at 9:05 AM, Fraser Hanson wrote: > https://play.golang.org/p/05wZM9BhfB > > I'm working on some code that reads UTF32 and converts it to go strings. > I'm finding some surprising behavior when casting slices of runes to > strings. > > runes :=

Re: [go-nuts] casting slice of rune to string picks up extra characters for some inputs

2017-02-28 Thread Rob Pike
https://en.wikipedia.org/wiki/UTF-8 https://blog.golang.org/strings -rob -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[go-nuts] casting slice of rune to string picks up extra characters for some inputs

2017-02-28 Thread Fraser Hanson
https://play.golang.org/p/05wZM9BhfB I'm working on some code that reads UTF32 and converts it to go strings. I'm finding some surprising behavior when casting slices of runes to strings. runes := []rune{'©'} fmt.Printf(" cast to string: (%s)\n", string(runes)) fmt.Printf("bytes in string: