Strange symbols in bash prompt after finished program

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)

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

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
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


in the csv file, then I need to press backspase twice to delete the Л› character, that’s strange, is not it?

1 Like

Your terminal and/or your CSV library can’t cope with the encoding used in the CSV.

1 Like

You can preprocess your output to convert the unicode to runes with something like

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.