Skip to content

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

@abgox

Description

@abgox

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-BugIt either shouldn't be doing this or needs an investigation.Needs-TriageIt's a new issue that the core contributor team needs to triage at the next triage meetingResolution-By-DesignIt's supposed to be this way. Sometimes for compatibility reasons.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions