Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Powershell returning an error whenever I use an emoji in the terminal #3915

Closed
3 tasks done
Keith-Web3 opened this issue Jan 8, 2024 · 6 comments
Closed
3 tasks done
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@Keith-Web3
Copy link

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

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.Encoding.GetBytesWithFallback(ReadOnlySpan`1 chars, Int32 originalCharsLength, Span`1 bytes, Int32 originalBytesLength, EncoderNLS encoder)
   at System.Text.Encoding.GetBytesWithFallback(Char* pOriginalChars, Int32 originalCharCount, Byte* pOriginalBytes, Int32 originalByteCount, Int32 charsConsumedSoFar, Int32 bytesWrittenSoFar, EncoderNLS encoder)
   at System.Text.EncoderNLS.GetBytes(Char* chars, Int32 charCount, Byte* bytes, Int32 byteCount, 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__DisplayClass99_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.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

Screenshot (362)

Environment data

PS Version: 7.3.10
PS HostName: ConsoleHost
PSReadLine Version: 2.2.6
PSReadLine EditMode: Windows
OS: 10.0.22000.1 (WinBuild.160101.0800)
BufferWidth: 122
BufferHeight: 18

Steps to reproduce

  1. Create a new folder
  2. cd into the folder
  3. Initialize a git repository in the folder with
    git init
    
  4. Make a change in the folder
  5. Stage and commit the change while adding an emoji in the commit message e.g Hello world 😂
  6. Run the commit command

Expected behavior

Commit the change with the emoji

Actual behavior

Throws an error saying "something went wrong" without further info on the error.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Jan 8, 2024
@Keith-Web3
Copy link
Author

Just realized there's already an open issue referencing the same error.

@StevenBucher98
Copy link
Collaborator

@Keith-Web3 thanks for submitting the issue! Can you link the issue you found that has the same error and we can close this one to track that one?

@Keith-Web3
Copy link
Author

Sure, it's #1329.
Seems there's been no update on the issue for about a year now.

@StevenBucher98
Copy link
Collaborator

Do you mind trying on PSReadLine 2.3.4 just to check that this is still an issue with the latest version of PSReadLine?

@Keith-Web3
Copy link
Author

Screenshot (363)
Still the same

@daxian-dbw
Copy link
Member

This is a duplicate of #3832 and is actually an issue with the older version of conpty that ships with Windows -- the � shown in VSCode terminal was because only the high surrogate of the surrogate pair that represents the emoji was pasted into the read-line buffer, due to the older version of conpty not handling it correctly.

See #3832 (comment) and the replying comment from @Tyriar for details.

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Jan 31, 2024
@daxian-dbw daxian-dbw added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. Issue-Emoji and removed Issue-Emoji labels Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

3 participants