Skip to content

Emoji breaks the git commit command #4969

@Erick-WG

Description

@Erick-WG

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

git commit -m "Last edit for the 100th ��" 

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.4.0-beta0+923a890f2e7ea10465f3a80a2bc030121a1c2f68
PowerShell: 2025.1.0
OS: Microsoft Windows 10.0.19045
BufferWidth: 66
BufferHeight: 39

Last 200 Keys:

 i l w i n d Spacebar c o n f i g u r a t i i Backspace o n s Spacebar t o Spacebar p r o c e s s Spacebar c s s Spacebar a n d Spacebar c Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace i t ' s Spacebar s t y l i n g Spacebar i n p u t Spacebar f o r Spacebar i t ' Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace u t i l i t y Spacebar c l a s s e s Enter
 g i t Spacebar p u s h Enter
 c l e a r Enter
 g i t Spacebar s t a t u s Enter
 g i t Spacebar a d d Spacebar . Enter
 g i t Spacebar c o m m i t Spacebar - m Spacebar " " LeftArrow L 
a s t Spacebar e d i Spacebar Backspace t Spacebar f o r Spacebar 
t h e Spacebar 1 0 0 t h Spacebar � � � Backspace Enter


### Exception

System.Text.EncoderFallbackException: Unable to translate Unicode 
character \uD83D at index 39 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__DisplayClass104_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

Image

Environment data

none

Steps to reproduce

add any emoji in the commit message

Expected behavior

staging complete with commit message

Actual behavior

the error shows up and you have to rewrite the message

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