Re: [go-nuts] Working with characters in strings

2016-10-31 Thread 'Thomas Bushnell, BSG' via golang-nuts
Sorry, I did not mean to say they are restricted to UTF8. I was answering the question "what is the relation between a rune and its byte representation", by saying that the []byte cast of a string (assuming the string only holds legitimate runes) is the UTF8 of the runes making it up. The original

Re: [go-nuts] Working with characters in strings

2016-10-31 Thread Lars Seipel
On Mon, Oct 31, 2016 at 06:06:23PM +, 'Thomas Bushnell, BSG' via golang-nuts wrote: > Strings are specified to be UTF8, so if you cast a string to []byte you > will see its UTF8 representation. They are not. A Go string may contain arbitrary bytes. Features like for..range or conversions to r

Re: [go-nuts] Working with characters in strings

2016-10-31 Thread 'Thomas Bushnell, BSG' via golang-nuts
I don't know what you mean by "characters", since you're distinguishing them from runes. Do you mean bytes? Strings are specified to be UTF8, so if you cast a string to []byte you will see its UTF8 representation. Thomas On Sat, Oct 29, 2016 at 4:42 AM wrote: > > I understand that strings are