Skip to content

Error when commiting to git with an emoji in the message flag #4010

Closed
@nandhu-44

Description

@nandhu-44

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.4
PowerShell: 7.5.0-preview.2
OS: Microsoft Windows 10.0.22631
BufferWidth: 141
BufferHeight: 15

Last 163 Keys:

 n Backspace n u m RightArrow Enter p i p Spacebar i n RightArrow Backspace Backspace Backspace Backspace Backspace Backspace a n d a s Enter p i p Spacebar - - v Enter e Backspace d e a c RightArrow Enter \ Backspace c l s Enter g i t Spacebar a d d Spacebar p a n a Backspace d a s / * . c s c Backspace v Enter g i t Spacebar a d d Spacebar * . j s o n Enter g i t Spacebar c o m m i t n Backspace Spacebar - m Spacebar " D a t a s e t s Spacebar f o r Spacebar p a n d a s " Enter g i t Spacebar a d d Spacebar . Enter g i t Spacebar c o m m i e Backspace t Spacebar - m Spacebar " P a n d a s Spacebar � " Enter

### Exception

System.Text.EncoderFallbackException: Unable to translate Unicode character \\uD83D at index 22 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 System.IO.TextWriter.Dispose()
   at Microsoft.PowerShell.PSConsoleReadLine.<>c__DisplayClass103_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)

Screenshot

image

Environment data

PS Version: 7.5.0-preview.2
PS HostName: ConsoleHost
PSReadLine Version: 2.3.4
PSReadLine EditMode: Windows
OS: 10.0.22621.1 (WinBuild.160101.0800)
BufferWidth: 141
BufferHeight: 40

Steps to reproduce

I was committing my code on to git where I used an emoji in the -m (message) flag.

Expected behavior

It was expected to commit the code and be able to push the changes.

Actual behavior

This error occured while doing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-EmojiResolution-DuplicateThere's another issue on the tracker that's pretty much the same thing.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions