Repository navigation
System.Text.EncoderFallbackException: Unable to translate Unicode character \uD83D at index 14 to specified code page. #5053
Copy link
Copy link
Open
Labels
Needs-Triage 🔍It's a new issue that core contributor team needs to triage.It's a new issue that core contributor team needs to triage.
Description
Activity
- addedNeeds-Triage 🔍It's a new issue that core contributor team needs to triage.It's a new issue that core contributor team needs to triage.
on Jan 7, 2026 Same here, only happens in vscode.
Using win+. to enter an emoji causes the first enter to crash and then I can hit enter again
~ ❯ pwsh -noprofile PowerShell 7.4.13 A new PowerShell stable release is available: v7.5.4 Upgrade now, or check out the release page at: https://aka.ms/PowerShell-Release?tag=v7.5.4 PS C:\Users\TeamD> write-host "�" Oops, something went wrong. Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections. Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml Thank you! Thank you! Thank you! Thank you! Thank you! ### Environment PSReadLine: 2.4.5 PowerShell: 7.4.13 OS: Microsoft Windows 10.0.19045 BufferWidth: 145 BufferHeight: 41 Last 15 Keys: w r i t e - h o s t Spacebar " � " Enter ### Exception System.Text.EncoderFallbackException: Unable to translate Unicode character \\uD83D at index 12 to specified code page. at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index) at System.Text.Encoding.GetBytesWithFallback(ReadOnlySpan`1 chars, Int32 originalCharsLength, Span`1 bytes, Int32 originalBytesLength, EncoderNLS encoder, Boolean throwForDestinationOverflow) at System.Text.Encoding.GetBytesWithFallback(Char* pOriginalChars, Int32 originalCharCount, Byte* pOriginalBytes, Int32 originalByteCount, Int32 charsConsumedSoFar, Int32 bytesWrittenSoFar, EncoderNLS encoder) at System.Text.Encoding.GetBytes(Char* pChars, Int32 charCount, Byte* pBytes, Int32 byteCount, EncoderNLS encoder) at System.Text.Encoder.GetBytes(ReadOnlySpan`1 chars, Span`1 bytes, Boolean flush) at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at Microsoft.PowerShell.PSConsoleReadLine.<>c__DisplayClass104_0.<WriteHistoryRange>b__0() at Microsoft.PowerShell.PSConsoleReadLine.WithHistoryFileMutexDo(Int32 timeout, Action action) at Microsoft.PowerShell.PSConsoleReadLine.WriteHistoryRange(Int32 start, Int32 end, Boolean overwritten) at Microsoft.PowerShell.PSConsoleReadLine.IncrementalHistoryWrite() at Microsoft.PowerShell.PSConsoleReadLine.MaybeAddToHistory(String result, List`1 edits, Int32 undoEditIndex, Boolean fromDifferentSession, Boolean fromInitialRead) at Microsoft.PowerShell.PSConsoleReadLine.InputLoop() at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus) PS C:\Users\TeamD> write-host "�" � PS C:\Users\TeamD>🔐
seems to only happen after using win+dot?
Metadata
Metadata
Assignees
Labels
Needs-Triage 🔍It's a new issue that core contributor team needs to triage.It's a new issue that core contributor team needs to triage.
Prerequisites
Exception report
Screenshot
VSCode's folder view displays name correctly
VSCode integrated PowerShell command (auto-complete)
Filename is not displayed correctly, exception occurred when executing the command:
Outside PowerShell has no problem/issue
The issue only occurs when running PowerShell which is integrated to VS Code, "normal" PowerShell executed from File Explorer works even with the UNICODE character
🕮:Environment data
Steps to reproduce
🕮 Finding Emulator.mdin file tree view🕮 Finding Emulator.md(INFO: Here the filename is correct but in Terminal window it looks like:Expected behavior
No exception: Copy&Paste should work with terminal window / VS Code; looks like they're using different encoding
Workaround: Type
markdownlintand press until ‘🕮 Finding Emulator.md’ appears. If the folder contains many files, you’ll need multiple tab presses because VS Code’s tree view sorts differently than the terminal’s completion order.Actual behavior
Copy&Paste inserts wrong UNICODE char + when executing the exception occurs.