Skip to content
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

Bug: For multi-byte characters like Chinese, some output encodings can cause incorrect text rendering. #18242

Open
abgox opened this issue Nov 24, 2024 · 0 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting

Comments

@abgox
Copy link

abgox commented Nov 24, 2024

Windows Terminal version

1.21.3231.0

Windows build number

10.0.22635.0

Other Software

PowerShell

Steps to reproduce

  • I cleared the contents of $profile,and added a test function in $profile.

    function test-render() {
        $text = @("你好你好你好", "😄😎🤔")
    
        $buffer = $Host.UI.RawUI.NewBufferCellArray($text, 'Cyan', 'Black')
        $Host.UI.RawUI.SetBufferContents($Host.UI.RawUI.CursorPosition, $buffer)
    
        $null = $host.UI.RawUI.ReadKey() # Suspend the process for easy observation
    }
  • There are two text rendering issues here.


  1. Emoji does not render properly in Windows Terminal Preview, but it works fine in ohter terminals like Windows Terminal,Tabby,Hyper.

Note

I'm in China, so the encoding of Windows Terminal (Preview) is automatically changed to GB2312.

But ohter terminals like Tabby and Hyper are using UTF8 encoding.

Image

Image


  1. When the output encoding is switched to UTF8, Windows Terminal (Preview) has unexpected behavior in rendering Chinese or other multi-byte characters, but it works fine in other terminals like Tabby,Hyper.

Note

other terminals like Tabby,Hyper works fine because they always use UTF8 encoding.

Image

Image

  • I switched to UTF8 with this regional setting.

    Image

Expected Behavior

  1. Emoji can render properly in Windows Terminal Preview.
  2. For multi-byte characters like Chinese, render it correctly and should not add spaces by mistake.

Actual Behavior

  1. Emoji can't render properly in Windows Terminal Preview.
  2. For multi-byte characters like Chinese, spaces are added incorrectly.
@abgox abgox added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting
Projects
None yet
Development

No branches or pull requests

1 participant