Unicode Emoji Causes Exception #13246

Open
opened 2026-01-31 03:37:40 +00:00 by claunia · 0 comments
Owner

Originally created by @0xC4DE on GitHub (Mar 31, 2021).

PSReadLine: 2.0.0
PowerShell: 5.1.21296.1000
OS: Microsoft Windows 10.0.21296

Expected Behavior: Not an exception, does command as usual

Actual Behavior: Causes an exception and prevents any command containing unicode emoji from working, but not every unicode emoji, haven't been able to test which emojis extensively, I have noticed that if they paste and display properly, they do not tend to cause errors, I imagine the traceback is more useful.


### Exception

System.Text.EncoderFallbackException: Unable to translate Unicode character \uD83D at index 0 to specified code page.
at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index)
at System.Text.EncoderFallbackBuffer.InternalFallback(Char ch, Char*& chars)
at System.Text.UTF8Encoding.GetBytes(Char* chars, Int32 charCount, Byte* bytes, Int32 byteCount, EncoderNLS baseEncoder)
at System.Text.EncoderNLS.GetBytes(Char[] chars, Int32 charIndex, Int32 charCount, Byte[] bytes, Int32 byteIndex, 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__DisplayClass83_0.b__0()
at Microsoft.PowerShell.PSConsoleReadLine.WithHistoryFileMutexDo(Int32 timeout, Action action)
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)


PS W:\desktop\tiktokdl> �✌✌
Symbols typed in above example, using windows emoji keyboard: 👍✌✌

Originally created by @0xC4DE on GitHub (Mar 31, 2021). PSReadLine: 2.0.0 PowerShell: 5.1.21296.1000 OS: Microsoft Windows 10.0.21296 Expected Behavior: Not an exception, does command as usual Actual Behavior: Causes an exception and prevents any command containing unicode emoji from working, but not every unicode emoji, haven't been able to test which emojis extensively, I have noticed that if they paste and display properly, they do not tend to cause errors, I imagine the traceback is more useful. ``` ### Exception ``` System.Text.EncoderFallbackException: Unable to translate Unicode character \uD83D at index 0 to specified code page. at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index) at System.Text.EncoderFallbackBuffer.InternalFallback(Char ch, Char*& chars) at System.Text.UTF8Encoding.GetBytes(Char* chars, Int32 charCount, Byte* bytes, Int32 byteCount, EncoderNLS baseEncoder) at System.Text.EncoderNLS.GetBytes(Char[] chars, Int32 charIndex, Int32 charCount, Byte[] bytes, Int32 byteIndex, 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__DisplayClass83_0.<WriteHistoryRange>b__0() at Microsoft.PowerShell.PSConsoleReadLine.WithHistoryFileMutexDo(Int32 timeout, Action action) 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) ``` PS W:\desktop\tiktokdl> �✌✌ Symbols typed in above example, using windows emoji keyboard: 👍✌✌
claunia added the Needs-TriageNeeds-Tag-Fix labels 2026-01-31 03:37:41 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13246