New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

psreadline multi-line problem with chinese heiti font family #542

Closed
chuanjiao10 opened this Issue Jun 19, 2017 · 9 comments

Comments

Projects
None yet
2 participants
@chuanjiao10

chuanjiao10 commented Jun 19, 2017

I think:
chinese heiti font family is default on windows,in the high-resolution display is beautiful.
Can not restrict user terminal software default font.

Steps to reproduce

1Run terminal software:putty or xshell

2Choose font name 'heiti' or 'microsoft yahei mono'

3Connect to linux and run powershell.

4Paste the following order and press Enter 3 --- 5 times.
Get-StringHash -Text 'powershell躺着进行数值计算'

look:
The phenomenon only appeared at this time:when psreadline + heiti font + past chinese string on linux.
No problem when press up key,run the history command.
No problem with songti family,eg:新宋体
No problem when remove-module psreadline
No problem on windows + powershell.only terminal software + powershell core.

Actual behavior

Environment data

Os:from windows 10
Terminal software:putty and xshell
Font:chinese heiti,microsoft yahei mono
Linux:

Name Value


PSVersion 6.0.0-beta
PSEdition Core
BuildVersion 3.0.0.0
CLRVersion
GitCommitId v6.0.0-beta.2
OS Linux 3.10.0-514.21.1.el7.x86_64 #1 SMP Thu May 25 17:04:51 UTC 2017
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

psreadline:
Major Minor Build Revision


1 2 -1 -1

reporter

By the chinese powershell study & research group. QQ group No. is 183173532

in 'vscode' or other open source project,in version release notes,bug reporter should be thank.
So I left a group name.

@chuanjiao10

This comment has been minimized.

Show comment
Hide comment
@chuanjiao10

chuanjiao10 commented Jun 19, 2017

mypsreadline5

@lzybkr

This comment has been minimized.

Show comment
Hide comment
@lzybkr

lzybkr Oct 17, 2017

Owner

I'm not sure I totally understand the issue, but I did fix another CJK issue, so I hope this is fixed by #561.

I'll publish a pre-release version to the PowerShell Gallery as soon as they support pre-releases.

If you'd like to try a fix before that, you can build the lastest yourself from the master branch, or
grab a build from AppVeyor like this one.

Note the version number is now 2.0, so be sure to copy the contents to \PSReadLine\2.0.

Owner

lzybkr commented Oct 17, 2017

I'm not sure I totally understand the issue, but I did fix another CJK issue, so I hope this is fixed by #561.

I'll publish a pre-release version to the PowerShell Gallery as soon as they support pre-releases.

If you'd like to try a fix before that, you can build the lastest yourself from the master branch, or
grab a build from AppVeyor like this one.

Note the version number is now 2.0, so be sure to copy the contents to \PSReadLine\2.0.

@lzybkr lzybkr added the Fixed? label Oct 17, 2017

@chuanjiao10

This comment has been minimized.

Show comment
Hide comment
@chuanjiao10

chuanjiao10 Oct 17, 2017

1 run the code "Get-StringHash -Text 'powershell躺着进行数值计算'" in powershell core 6.0 beta8 in centos7.

2 download the zip,then put it into '/opt/microsoft/powershell/6.0.0-beta.8/Modules/PSReadLine/2.0'

ls -l '/opt/microsoft/powershell/6.0.0-beta.8/Modules/PSReadLine/2.0'                                                                               
总用量 324
-rw-r--r--. 1 root root  12418 10月 17 09:46 Changes.txt
drwxr-xr-x. 2 root root   4096 10月 17 09:46 en-US
-rw-r--r--. 1 root root   1300 10月 17 09:46 License.txt
-rw-r--r--. 1 root root 221696 10月 17 09:46 Microsoft.PowerShell.PSReadLine.dll
-rw-r--r--. 1 root root   5730 10月 17 09:46 PSReadLine.format.ps1xml
-rw-r--r--. 1 root root    792 10月 17 09:46 PSReadLine.psd1
-rw-r--r--. 1 root root    175 10月 17 09:46 PSReadLine.psm1
-rw-r--r--. 1 root root  20813 10月 17 09:46 SamplePSReadlineProfile.ps1
-rw-r--r--. 1 root root  33256 10月 17 09:46 System.Runtime.InteropServices.RuntimeInformation.dll

3 restart my vm,powershell,run the code
4 Multi lines still from the code, the third time.
Return change:
heiti font family and songti font family are so

Environment change:
powershell core 6.0 beta2 ----> 6.0 beta8
centos7 7.3 1611 ----> centos7 7.4 1708

note:
restart terminal software mybe needed.

chuanjiao10 commented Oct 17, 2017

1 run the code "Get-StringHash -Text 'powershell躺着进行数值计算'" in powershell core 6.0 beta8 in centos7.

2 download the zip,then put it into '/opt/microsoft/powershell/6.0.0-beta.8/Modules/PSReadLine/2.0'

ls -l '/opt/microsoft/powershell/6.0.0-beta.8/Modules/PSReadLine/2.0'                                                                               
总用量 324
-rw-r--r--. 1 root root  12418 10月 17 09:46 Changes.txt
drwxr-xr-x. 2 root root   4096 10月 17 09:46 en-US
-rw-r--r--. 1 root root   1300 10月 17 09:46 License.txt
-rw-r--r--. 1 root root 221696 10月 17 09:46 Microsoft.PowerShell.PSReadLine.dll
-rw-r--r--. 1 root root   5730 10月 17 09:46 PSReadLine.format.ps1xml
-rw-r--r--. 1 root root    792 10月 17 09:46 PSReadLine.psd1
-rw-r--r--. 1 root root    175 10月 17 09:46 PSReadLine.psm1
-rw-r--r--. 1 root root  20813 10月 17 09:46 SamplePSReadlineProfile.ps1
-rw-r--r--. 1 root root  33256 10月 17 09:46 System.Runtime.InteropServices.RuntimeInformation.dll

3 restart my vm,powershell,run the code
4 Multi lines still from the code, the third time.
Return change:
heiti font family and songti font family are so

Environment change:
powershell core 6.0 beta2 ----> 6.0 beta8
centos7 7.3 1611 ----> centos7 7.4 1708

note:
restart terminal software mybe needed.

@lzybkr

This comment has been minimized.

Show comment
Hide comment
@lzybkr

lzybkr Oct 17, 2017

Owner

I don't think PowerShell Core will load new versions of PSReadLine that way because it has a "trusted platform assembly".

You need to replace these files:

/opt/microsoft/powershell/6.0.0-beta.8/Microsoft.PowerShell.PSReadLine.dll
/opt/microsoft/powershell/6.0.0-beta.8/Modules/PSReadLine/PSReadLine.psd1

And add:

/opt/microsoft/powershell/6.0.0-beta.8/Modules/PSReadLine/PSReadLine.format.ps1xml

After replacing those files, you can verify you have the latest version with: Get-Module PSReadLine, it should report version 2.0. Another check, the following should be true:

PS> (Get-PSReadlineOption).CommandColor[0] -eq 0x1b
True
Owner

lzybkr commented Oct 17, 2017

I don't think PowerShell Core will load new versions of PSReadLine that way because it has a "trusted platform assembly".

You need to replace these files:

/opt/microsoft/powershell/6.0.0-beta.8/Microsoft.PowerShell.PSReadLine.dll
/opt/microsoft/powershell/6.0.0-beta.8/Modules/PSReadLine/PSReadLine.psd1

And add:

/opt/microsoft/powershell/6.0.0-beta.8/Modules/PSReadLine/PSReadLine.format.ps1xml

After replacing those files, you can verify you have the latest version with: Get-Module PSReadLine, it should report version 2.0. Another check, the following should be true:

PS> (Get-PSReadlineOption).CommandColor[0] -eq 0x1b
True
@chuanjiao10

This comment has been minimized.

Show comment
Hide comment
@chuanjiao10

chuanjiao10 Oct 17, 2017

yes, fixed! Multi lines gone.
but paste into command line Garbled.

xshell + heiti font family

xshell

============
putty 0.70 + default font (songti font family)
putty

chuanjiao10 commented Oct 17, 2017

yes, fixed! Multi lines gone.
but paste into command line Garbled.

xshell + heiti font family

xshell

============
putty 0.70 + default font (songti font family)
putty

@lzybkr

This comment has been minimized.

Show comment
Hide comment
@lzybkr

lzybkr Oct 17, 2017

Owner

Odd. It looks like the error message has the correct text which means PowerShell received the right input. I'm guessing it isn't paste then - do you see the same thing when typing?

I wonder what might be wrong. Maybe PSReadLine is setting the wrong code page? I think the fix was setting the output encoding to Unicode, at least that was the fix on Windows.

FWIW, pasting on Windows works correctly with the KaiTi or NSimSun fonts

Owner

lzybkr commented Oct 17, 2017

Odd. It looks like the error message has the correct text which means PowerShell received the right input. I'm guessing it isn't paste then - do you see the same thing when typing?

I wonder what might be wrong. Maybe PSReadLine is setting the wrong code page? I think the fix was setting the output encoding to Unicode, at least that was the fix on Windows.

FWIW, pasting on Windows works correctly with the KaiTi or NSimSun fonts

@chuanjiao10

This comment has been minimized.

Show comment
Hide comment
@chuanjiao10

chuanjiao10 Oct 18, 2017

do you see the same thing when typing?
-------yes.command line type chinese letter Garbled.
remove-module psreadline,then typing,normal.

011_putty-2

chuanjiao10 commented Oct 18, 2017

do you see the same thing when typing?
-------yes.command line type chinese letter Garbled.
remove-module psreadline,then typing,normal.

011_putty-2

@lzybkr

This comment has been minimized.

Show comment
Hide comment
@lzybkr

lzybkr Nov 4, 2017

Owner

Hopefully this is fixed now - reactivate if not. I made one relevant change that was affecting Linux in other ways - I switched from Unicode to UTF8 output - hopefully that fixes the problem you were seeing too.

I'll have an official prerelease build out next week if you want to verify this is fixed, otherwise you can grab a build out of appveyor here.

Owner

lzybkr commented Nov 4, 2017

Hopefully this is fixed now - reactivate if not. I made one relevant change that was affecting Linux in other ways - I switched from Unicode to UTF8 output - hopefully that fixes the problem you were seeing too.

I'll have an official prerelease build out next week if you want to verify this is fixed, otherwise you can grab a build out of appveyor here.

@lzybkr lzybkr closed this Nov 4, 2017

@chuanjiao10

This comment has been minimized.

Show comment
Hide comment
@chuanjiao10

chuanjiao10 Nov 6, 2017

YES,i tested,it fixed!
Good job,thank you!

chuanjiao10 commented Nov 6, 2017

YES,i tested,it fixed!
Good job,thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment