Skip to content

Incorrect terminal tab title when cwd contains non-ascii characters #170139

Closed
@JLHwung

Description

@JLHwung

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: Version: 1.74.2 (e8a3071)
  • OS Version: Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 arm64
  • Tried search terms: non-ascii, unicode, cwd, terminal

Steps to Reproduce:

  1. Create a new folder named "文件" and open with VS code
mkdir 文件
code 文件
  1. Click "Terminal" -> "New Terminal"
  2. Observe the terminal tab list.

Current:
image

The tab title is printed as zsh - �件

Expected: zsh. Here the shell is open from the same folder as cwd, but VSCode incorrectly handles non-ascii cwd names and the UI thought the shell is launched from a different folder.

Since the cwd of the TerminalInstance is now wrong, if we click the tab to split a new terminal with the same cwd, VSCode will throw " �件" does not exist.

This is likely a regression introduced in #165633: The __vsc_escape_value routine interprets the utf-8 encoded string "文件" as an ISO/ 8859-1 string "æ��ä»¶", then escaped as "\xE6\x96\x87\xE4\xBB\xB6", because the text is processed byte by byte.

Potential solution:

  1. Escape only a limited character sets for cwd and leave other characters as-is
  2. Enhance current escape scheme to support multi-byte strings

Metadata

Metadata

Assignees

Labels

*duplicateIssue identified as a duplicate of another issue(s)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions