When my program finished a bash promt looks like (last line):
...
{Name:Herriman Country:United States Subcountry:Utah Geonameid:5775782}
{Name:Highland Country:United States Subcountry:Utah Geonameid:5775863}
{Name:Holladay Country:United States Subcountry:Utah Geonameid:5776008}
^[[?1;2cuser@comp:~/go/src/cities$ 1;2c1;2c1;2c1;2c1;2c
here is the code
for _, c := range cities {
fmt.Printf("%+v\n", c)
}
fmt.Printf("\n")
Why those symbols produced?
If I run that file from an os terminal then the bash promt look like
user@comp:~/go/src/cities$ 62;c62;c62;c62;c62;c62;c62;c62;c62;c62;c62;c62;c62;c62;c62;c62;c62;c62;c62;c
1 Like
skillian
(Sean Killian)
July 20, 2019, 10:28pm
2
Hi, @cinematik , that’s not a full program, so I can’t test it to see if I can reproduce it. Based on what you posted, I’m currently under the assumption there might be some binary data in what you’re printing out somewhere (maybe in the snippet above, maybe not) that is affecting the terminal.
1 Like
Hi, @skillian , I found out that it’s a source file produces such result. I have a huge csv file with such a structure
Don Luan,Vietnam,BУЌnh PhЦАсЛc,1582436
I unmarshal it with github.com/jszwec/csvutil
and the above input gives me output in console:
user@comp:~/go/src/cities$ 1;2c
Next I reduce the source to this
Don Luan,Vietnam,Лc,1582436
the output
{Name:Don Luan Country:Vietnam Subcountry:Л Geonameid:1582436}
user@comp:~/go/src/cities$ 1;2c
and when I put the cursor in the middle of that
Лc
in the csv file, then I need to press backspase twice to delete the Л character, that’s strange, is not it?
1 Like
NobbZ
(Norbert Melzer)
July 21, 2019, 7:59am
4
Your terminal and/or your CSV library can’t cope with the encoding used in the CSV.
1 Like
clbanning
(Charles Banning)
July 21, 2019, 12:13pm
5
You can preprocess your output to convert the unicode to runes with something like https://godoc.org/github.com/clbanning/unigo .
1 Like
system
(system)
Closed
October 19, 2019, 12:17pm
6
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.