dbcli / mssql-cli

A command-line client for SQL Server with auto-completion and syntax highlighting
BSD 3-Clause "New" or "Revised" License
1.36k stars 190 forks source link

Different display of cli in PowerShell and Command Prompt #111

Open bonskijr opened 6 years ago

bonskijr commented 6 years ago

mssql-cli displays differently when being used inPowershell console. In command prompt it displays as it should but in Powershell it display filler "rectangle" for spaces.

Poweshell

image

Command Prompt

image

mssql-cli v 0.7 .0 OS: Windows 10.0.15063 PowerShell : 5.1.15063.726

abhisheksinha89 commented 6 years ago

Hi, I am not able to repro this on Win10 Powershell 5.1 Can you tell me what codepage you are using for the powershell terminal?

bonskijr commented 6 years ago

The original codepage was 437 (US) image

Then after running the cli changed to 65001 (UTF-8)

image

But as you can see both have the issue, at least for me

abhisheksinha89 commented 6 years ago

Thanks I'll need to investigate this. I can't seem to repro this on 2 of our machines using version 0.8.0. I noticed that you still have version 0.7.0. Try doing a pip install --upgrade mssql-cli

Eventhough I think we didn't make any major changes just try upgrading and see if the problem persists. I'll try to get a repro so I can investigate this on my end.

bonskijr commented 6 years ago

Hi @abhisheksinha89 ,

I tried upgrading but issue still persist, but thanks for looking into this.

image

ghost commented 6 years ago

I having the issue also and using 65001(UTF-8) code page is there a fix in sight. using windows 10 and powershell shell also occurs on cmd shell.

image image

But if I use the cmd shell in legacy mode works fine

image

image

hope this helps

MrMeemus commented 6 years ago

I was able to repro this issue even with a simple prompt from prompt tool kit. Could potentially be a renderer issue. Will keep digging and update here.

MrMeemus commented 6 years ago

@bonskijr @snewfie , I wasn't able to pinpoint a exact issue from the source. It looks like it could be a font issue with decoding the transparent characters within the prompt toolkit. I was able to fix this issue by switching my font (Lucida Console) for Powershell to some other font (Raster fonts) which removed the rectangular characters. I also verified switching the new font back to the original font did not return the rectangles.

It could have been a font mismatch in the mapping where the OS wasn't font substituting properly.

TL;DR

Using legacy console:

Not using legacy console:

Either way, let me know if this resolved your issue. If the issue persists, I can dig further.

Thanks!

jonathanslenders commented 6 years ago

This looks like a prompt_toolkit issue indeed. I can reproduce it with the example prompt applications.

Which Python version are you using? I don't remember that we were changing the code page, but I think Python 3.6 does. In any case, I think we can probably fix it.

Also notice that prompt_toolkit 2.0 (non yet released), can render using vt100 escape sequences on Windows 10, which is also more efficient.

bonskijr commented 6 years ago

hi @jonathanslenders , running Python 2.7.1 so I can tinker with Sql op studio source(requirement).

But I'm not sure what I installed or applied but it looks ok to me now

image

MrMeemus commented 6 years ago

@bonskijr , did you happen to change your font or python version since the first time you reported the issue? Does it still repro if you use 3.6?

ghost commented 6 years ago

changing the font fixes the issue wihout needing to use legacy mode

used consolas

thx for all the input guys

ghost commented 6 years ago

image

bonskijr commented 6 years ago

@MrMeemus no changes in font, default was Consolas ( see first screenshots ).

I think its probably related to codepage, at first cmd/ps, my codepage s 437 and upon exit from mssql-cli changes to 65001

image

note: not sure why this changed to v.0.9 of mssq-cli, probably because I also have the source downloaded?

MrMeemus commented 6 years ago

Closing this issue with the troubleshooting steps in place merged above.

pensivebrian commented 6 years ago

Let's leave this issue open as it still exists, we just have a workaround.