Powershell 中的 Unicode 字符加倍(在 Cmder 下运行)

Powershell 中的 Unicode 字符加倍(在 Cmder 下运行)

好吧,这有点奇怪。过去几年,我一直使用 Unicode 闪电符号作为 Powershell 中的提示符。我刚买了一台新笔记本电脑,重新安装了所有东西。我使用 Cmder 运行 Powershell,并将整个目录备份到 Dropbox 并恢复到我的新笔记本电脑上,因此不会发生任何变化。现在,我的提示符是两个闪电符号。提示函数如下所示:

Write-Host -ForegroundColor Yellow -NoNewLine "`n" ([char]0x26a1).ToString()

当我运行此命令时,我得到: 在此处输入图片描述

因此,字符 0x26a1 基本上是两个螺栓而不是一个。相同版本的 Windows 10、相同版本的 Powershell、相同版本的 Cmder,所有设置都相同。是什么导致 PowerShell 呈现这样的 Unicode 符号?还有一些其他字符是成倍的(例如 26aa 是两个圆圈),但大多数字符都没问题(2601 是一朵云)。我也在终端中尝试了各种字体,但每种字体都是成倍的。Windows 的哪个部分应该负责?谢谢!

更新:设置文件

# name: Pressing Ctrl-D exits session
# type: bool
# Ctrl-D exits cmd.exe when it is pressed on an empty line.
ctrld_exits = 1

# name: Toggle if pressing Esc clears line
# type: bool
# Clink clears the current line when Esc is pressed (unless Readline's Vi mode
# is enabled).
esc_clears_line = 1

# name: Match display colour
# type: int
# Colour to use when displaying matches. A value less than 0 will be the
# opposite brightness of the default colour.
match_colour = -1

# name: Executable match style
# type: enum
#  0 = PATH only
#  1 = PATH and CWD
#  2 = PATH, CWD, and directories
# Changes how Clink will match executables when there is no path separator on
# the line. 0 = PATH only, 1 = PATH and CWD, 2 = PATH, CWD, and directories. In
# all cases both executables and directories are matched when there is a path
# separator present. A value of -1 will disable executable matching completely.
exec_match_style = 2

# name: Whitespace prefix matches files
# type: bool
# If the line begins with whitespace then Clink bypasses executable matching and
# will match all files and directories instead.
space_prefix_match_files = 1

# name: Colour of the prompt
# type: int
# Surrounds the prompt in ANSI escape codes to set the prompt's colour. Disabled
# when the value is less than 0.
prompt_colour = -1

# name: Auto-answer terminate prompt
# type: enum
#  0 = Disabled
#  1 = Answer 'Y'
#  2 = Answer 'N'
# Automatically answers cmd.exe's 'Terminate batch job (Y/N)?' prompts. 0 =
# disabled, 1 = answer 'Y', 2 = answer 'N'.
terminate_autoanswer = 0

# name: Lines of history saved to disk
# type: int
# When set to a positive integer this is the number of lines of history that
# will persist when Clink saves the command history to disk. Use 0 for infinite
# lines and <0 to disable history persistence.
history_file_lines = 10000

# name: Skip adding lines prefixed with whitespace
# type: bool
# Ignore lines that begin with whitespace when adding lines in to the history.
history_ignore_space = 0

# name: Controls how duplicate entries are handled
# type: enum
#  0 = Always add
#  1 = Ignore
#  2 = Erase previous
# If a line is a duplicate of an existing history entry Clink will erase the
# duplicate when this is set 2. A value of 1 will not add duplicates to the
# history and a value of 0 will always add lines. Note that history is not
# deduplicated when reading/writing to disk.
history_dupe_mode = 2

# name: Read/write history file each line edited
# type: bool
# When non-zero the history will be read from disk before editing a new line and
# written to disk afterwards.
history_io = 0

# name: Sets how command history expansion is applied
# type: enum
#  0 = Off
#  1 = On
#  2 = Not in single quotes
#  3 = Not in double quote
#  4 = Not in any quotes
# The '!' character in an entered line can be interpreted to introduce words
# from the history. This can be enabled and disable by setting this value to 1
# or 0. Values or 2, 3 or 4 will skip any ! character quoted in single, double,
# or both quotes respectively.
history_expand_mode = 4

# name: Support Windows' Ctrl-Alt substitute for AltGr
# type: bool
# Windows provides Ctrl-Alt as a substitute for AltGr, historically to support
# keyboards with no AltGr key. This may collide with some of Readline's
# bindings.
use_altgr_substitute = 1

# name: Strips CR and LF chars on paste
# type: enum
#  0 = Paste unchanged
#  1 = Strip
#  2 = As space
# Setting this to a value >0 will make Clink strip CR and LF characters from
# text pasted into the current line. Set this to 1 to strip all newline
# characters and 2 to replace them with a space.
strip_crlf_on_paste = 2

# name: Enables basic ANSI escape code support
# type: bool
# When printing the prompt, Clink has basic built-in support for SGR ANSI escape
# codes to control the text colours. This is automatically disabled if a third
# party tool is detected that also provides this facility. It can also be
# disabled by setting this to 0.
ansi_code_support = 1

ConEmu版本信息:

ConEmu 161206 [32] Startup Info
  OsVer: 10.0.17763.x64, Product: 1, SP: 0.0, Suite: 0x100, SM_SERVERR2: 0
  CSDVersion: , ReactOS: 0 (), Rsrv: 0
  DBCS: 0, WINE: 0, PE: 0, Remote: 0, ACP: 1252, OEMCP: 437, Admin: 0
  StartTime: 2019-01-04 19:41:25.472
  AppID: 
  Desktop: `Winsta0\Default`, SessionId: 1, ConsoleSessionId: 1
  Title: `ConEmu  -?`
  Size: {0,1},{100,100}
  Flags: 0x00000000, ShowWindow: 1, ConHWnd: 0x00000000
  char: 1, short: 2, int: 4, long: 4, u64: 8
  Handles: 0x00000000, 0x00000000, 0x00000000
  Current PID: 7588, TID: 15944
  Active HKL: 0x04090409
  GetKeyboardLayoutList: 0x04090409
CmdLine: ConEmu  -?
ExecMod: C:\tools\Cmder\vendor\conemu-maximus5\ConEmu.exe
WorkDir: C:\tools\Cmder\vendor\conemu-maximus5
PathEnv: C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Docker\Docker\Resources\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\tools;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Program Files\Microsoft Service Fabric\bin\Fabric\Fabric.Code;C:\Program Files\Microsoft SDKs\Service Fabric\Tools\ServiceFabricLocalClusterManager;C:\Users\michael.christensen\AppData\Local\Microsoft\WindowsApps;C:\tools\Cmder;
ConFont: 0  Lucida Console  00  Consolas
CMD's AutoRuns: {not defined}
Foreground: x001F0BA4 {160,160}-{1279,807} 'ConsoleWindowClass' - C:\WINDOWS\system32\cmd.exe
MouseCursor: {246,744} MouseMonitor: 003C07AD StartMonitor: 00000000
Display: bpp=32, planes=1, align=1, vrefr=60, shade=x00000000, rast=x00007E99, dpi=120x120, per-mon-dpi=1
Monitors (dpi: WholeDesktop, Effective, Angular, RAW):
  003C07AD: {0,0}-{1920,1080} (1920x1080), Working: {0,0}-{1920,1030} (1920x1030), dpi: {120,120};{120,120};{137,137};{157,157} `\\.\DISPLAY1` <<== Primary
Modules:
  00400000-00611FFF   212000 C:\tools\Cmder\vendor\conemu-maximus5\ConEmu.exe
  771B0000-7734BFFF   19C000 C:\WINDOWS\SYSTEM32\ntdll.dll
  75510000-755EFFFF    E0000 C:\WINDOWS\System32\KERNEL32.DLL
  75A10000-75C08FFF   1F9000 C:\WINDOWS\System32\KERNELBASE.dll
  75870000-75A08FFF   199000 C:\WINDOWS\System32\USER32.dll
  74850000-74866FFF    17000 C:\WINDOWS\System32\win32u.dll
  74870000-74892FFF    23000 C:\WINDOWS\System32\GDI32.dll
  76CA0000-76E06FFF   167000 C:\WINDOWS\System32\gdi32full.dll
  76B10000-76B8FFFF    80000 C:\WINDOWS\System32\msvcp_win.dll
  75070000-75192FFF   123000 C:\WINDOWS\System32\ucrtbase.dll
  76C20000-76C9DFFF    7E000 C:\WINDOWS\System32\ADVAPI32.dll
  75270000-7532FFFF    C0000 C:\WINDOWS\System32\msvcrt.dll
  76E60000-76ED8FFF    79000 C:\WINDOWS\System32\sechost.dll
  76EE0000-76F9EFFF    BF000 C:\WINDOWS\System32\RPCRT4.dll
  74820000-7483FFFF    20000 C:\WINDOWS\System32\SspiCli.dll
  74810000-74819FFF     A000 C:\WINDOWS\System32\CRYPTBASE.dll
  75480000-754E1FFF    62000 C:\WINDOWS\System32\bcryptPrimitives.dll
  75C10000-7615CFFF   54D000 C:\WINDOWS\System32\SHELL32.dll
  76850000-7688AFFF    3B000 C:\WINDOWS\System32\cfgmgr32.dll
  76760000-767E8FFF    89000 C:\WINDOWS\System32\shcore.dll
  755F0000-75867FFF   278000 C:\WINDOWS\System32\combase.dll
  76160000-7675AFFF   5FB000 C:\WINDOWS\System32\windows.storage.dll
  754F0000-7550BFFF    1C000 C:\WINDOWS\System32\profapi.dll
  75420000-75473FFF    54000 C:\WINDOWS\System32\powrprof.dll
  76800000-76843FFF    44000 C:\WINDOWS\System32\shlwapi.dll
  74A10000-74A1EFFF     F000 C:\WINDOWS\System32\kernel.appcore.dll
  74F10000-74F21FFF    12000 C:\WINDOWS\System32\cryptsp.dll
  76A10000-76B09FFF    FA000 C:\WINDOWS\System32\COMDLG32.dll
  76900000-769FBFFF    FC000 C:\WINDOWS\System32\ole32.dll
  73C60000-73C67FFF     8000 C:\WINDOWS\SYSTEM32\VERSION.dll
  74A20000-74ABAFFF    9B000 C:\WINDOWS\System32\OLEAUT32.dll
  70FB0000-711BEFFF   20F000 C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.17763.195_none_4d616d831b9c5e9f\COMCTL32.dll
  73330000-73353FFF    24000 C:\WINDOWS\SYSTEM32\WINMM.dll
  73D60000-73D72FFF    13000 C:\WINDOWS\SYSTEM32\NETAPI32.dll
  73300000-73322FFF    23000 C:\WINDOWS\SYSTEM32\WINMMBASE.dll
  73D50000-73D5AFFF     B000 C:\WINDOWS\SYSTEM32\NETUTILS.DLL
  73760000-73774FFF    15000 C:\WINDOWS\SYSTEM32\SAMCLI.DLL
  76E10000-76E34FFF    25000 C:\WINDOWS\System32\IMM32.DLL
  70B90000-70C0AFFF    7B000 C:\WINDOWS\system32\uxtheme.dll
  70330000-70355FFF    26000 C:\WINDOWS\SYSTEM32\dwmapi.dll
  76FA0000-77138FFF   199000 C:\WINDOWS\System32\CRYPT32.dll
  767F0000-767FDFFF     E000 C:\WINDOWS\System32\MSASN1.dll

相关内容