[go-nuts] Re: scanner.Text() every other character is null.

2018-11-20 Thread Alex Dvoretskiy
If you using vim, keep using it: https://github.com/fatih/vim-go On Tuesday, November 20, 2018 at 11:28:03 AM UTC-8, Alex Dvoretskiy wrote: > > > > file, err := os.Open(inputFile) > if err != nil { > log.Fatal(err) > } > defer file.Close() > scanner := bufio.NewScanner(file) > address := "" > > sc

Re: [go-nuts] Re: scanner.Text() every other character is null.

2018-11-20 Thread Ian Lance Taylor
On Tue, Nov 20, 2018 at 11:43 AM, Alex Dvoretskiy wrote: > > Yes, it's encoded in UCS-2, UTF-16. > > Should I just change encoding to UTF-8? Yes. > What if I can't change encoding? One approach is to use https://godoc.org/golang.org/x/text/encoding/unicode with https://godoc.org/golang.org/x/te

Re: [go-nuts] Re: scanner.Text() every other character is null.

2018-11-20 Thread Robert Engels
You can’t just “change the encoding”. You need to read the strings as utf16. See https://gist.github.com/bradleypeabody/185b1d7ed6c0c2ab6cec > On Nov 20, 2018, at 1:43 PM, Alex Dvoretskiy wrote: > > Yes, it's encoded in UCS-2, UTF-16. > > Should I just change encoding to UTF-8? > > What if I

Re: [go-nuts] Re: scanner.Text() every other character is null.

2018-11-20 Thread Alex Dvoretskiy
Yes, it's encoded in UCS-2, UTF-16. Should I just change encoding to UTF-8? What if I can't change encoding? On Tuesday, November 20, 2018 at 11:36:24 AM UTC-8, Ian Lance Taylor wrote: > > On Tue, Nov 20, 2018 at 11:30 AM, Alex Dvoretskiy > > wrote: > > go version go1.10 windows/386 > > Is y

Re: [go-nuts] Re: scanner.Text() every other character is null.

2018-11-20 Thread Ian Lance Taylor
On Tue, Nov 20, 2018 at 11:30 AM, Alex Dvoretskiy wrote: > go version go1.10 windows/386 Is your input file encoded using UCS-2 aka UTF-16? Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving e

[go-nuts] Re: scanner.Text() every other character is null.

2018-11-20 Thread Alex Dvoretskiy
go version go1.10 windows/386 -- 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 golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.goo