Skip to content

PS requested bug report when I posted the eyes emojis as a string and hit Enter #4873

@mrenton999

Description

@mrenton999

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

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!

### Environment
PSReadLine: 2.3.6+d2e770f93b7a53d8660a6402eb29d1ae1c35e767
PowerShell: 7.5.2
OS: Microsoft Windows 10.0.26100
BufferWidth: 180
BufferHeight: 9001

Last 200 Keys:

 Spacebar b o o k s Enter
 m o v e Spacebar \ 2 \ e B o o k s Spacebar \ e B o o k s Enter
 d Spacebar c : Spacebar d Backspace - d i r Spacebar Enter
 UpArrow Home RightArrow RightArrow RightArrow RightArrow \ Enter
 d Spacebar c : \ e b o o k s Tab Enter
 g s f Spacebar D o w n l o a d s Enter
 UpArrow Home Ctrl+RightArrow * Delete d End * Enter
 UpArrow Home RightArrow RightArrow RightArrow RightArrow RightArrow Delete Enter
 d Spacebar C : \ U s e r s \ m w r e n \ D o w n l o a d s \ * . e p u b Enter
 UpArrow \ T h e Tab Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace T h e Tab Enter
 UpArrow Home Delete m o v e End Spacebar \ e B o o k s \ Enter
 c d Spacebar \ e B o o Tab Enter
 d Enter
 b l o t Spacebar T h e Tab Enter
 Enter
 ' � � � � Backspace ' Enter


### Exception

System.Text.EncoderFallbackException: Unable to translate Unicode character \\uD83D at index 3 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.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
   at System.IO.StreamWriter.Dispose(Boolean disposing)
   at Microsoft.PowerShell.PSConsoleReadLine.<>c__DisplayClass103_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, Nullable`1 lastRunStatus)

Screenshot

Copied emojis from another window, pasted them into PowerShell after a quote, hit so only 1 pair of eyes showed, typed the other quote; I think that's when the exception occurred
I think the text pasted was: 👀👀

Image

Environment data

PS Version: 7.5.2
PS HostName: ConsoleHost
PSReadLine Version: 2.3.6
PSReadLine EditMode: Windows
OS: 10.0.26100.1 (WinBuild.160101.0800)
BufferWidth: 180
BufferHeight: 9001

Steps to reproduce

At PS prompt type single quote, paste this pair of double-eye emojis: 👀👀
Press once; the eyes emoji and a <?> symbol appear
type another single quote, press Enter
(boom)

Expected behavior

The string of unicode characters should be echoed to the window

Actual behavior

The above exception happens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions