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

Unable to translate Unicode character \\uD83D #3847

Closed
3 tasks done
1oneand1 opened this issue Oct 24, 2023 · 3 comments
Closed
3 tasks done

Unable to translate Unicode character \\uD83D #3847

1oneand1 opened this issue Oct 24, 2023 · 3 comments

Comments

@1oneand1
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

Oops, something went wrong.
### Environment
PSReadLine: 2.2.6
PowerShell: 7.3.8
OS: Microsoft Windows 10.0.22621
BufferWidth: 120
BufferHeight: 9001

Last 69 Keys:

 c d Spacebar ~ Enter
 d i r Enter
 c d Spacebar P y Tab Enter
 c d Spacebar P Tab Enter
 d i r Enter
 . / b l a Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace p y t h o n Spacebar b l a s t _ o f f . p y Enter
 � � � Backspace Backspace Backspace Backspace � Enter


### 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.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.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.3.8
PS HostName: ConsoleHost
PSReadLine Version: 2.2.6
PSReadLine EditMode: Windows
OS: 10.0.22621.2338 (WinBuild.160101.0800)
BufferWidth: 120
BufferHeight: 9001

Steps to reproduce

🚀 This unicode character doesn't appear in the terminal input but can be displayed as a output in a Python code print function.

Expected behavior

To be able to be taken as a terminal input like it is showed as an output.

Actual behavior

It can't be displayed as an input.

@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 Oct 24, 2023
@daxian-dbw
Copy link
Member

@1oneand1 How did you type the character🚀 to the command line? Did you right click the mouse to trigger the Paste operation?
Can you try ctrl+v to paste the emoji character and see if that works?

@1oneand1
Copy link
Author

@1oneand1 How did you type the character🚀 to the command line? Did you right click the mouse to trigger the Paste operation? Can you try ctrl+v to paste the emoji character and see if that works?

I typed it buy Copying it and Paste it. I tryed again and with ctrl+v worked this time. :)

@daxian-dbw
Copy link
Member

Thanks for trying ctrl+v and confirming it works.
Right-click pasting has various known issues including omitting part of a Unicode character. In your case, the low surrogate of the emoji surrogate pair got lost by the right-click pasting. It's always recommended to use ctrl+v for pasting in PowerShell.

I will resolve this issue as a duplicate of #579

@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 Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants