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

Emojis aren't working in powershell 7 😭 #1594

Closed
0xW1sKy opened this issue Jun 7, 2020 · 6 comments
Closed

Emojis aren't working in powershell 7 😭 #1594

0xW1sKy opened this issue Jun 7, 2020 · 6 comments
Labels
Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@0xW1sKy
Copy link

0xW1sKy commented Jun 7, 2020

Environment

PS version: 7.1.0-preview.3
PSReadline version: 2.0.1
os: 10.0.19041.1 (WinBuild.160101.0800)
PS file version: 7.1.0.0
HostName: ConsoleHost
BufferWidth: 215
BufferHeight: 40

Exception report

Last 14 Keys

 � RightArrow Backspace Delete Delete Backspace Enter
 e c h o Spacebar � Enter

Exception

System.Text.EncoderFallbackEx�ception: Unable to translate Unicode character \\uD83D at index 5 to specified code page.
   at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index)
   at System.Text.EncoderFallbackBuffer.InternalFallback(ReadOnlySpan`1 cha�rs, Int32& charsConsumed)
   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.Encoding.GetBytes(Char* pChars, Int32 charCount, Byte* pBytes, Int32 byteCount, EncoderNLS enc�oder)
   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__DisplayClass83_0.<WriteHistoryRange>b__0()
   at Microsoft.PowerShell.PSConsoleReadLine.WithHistoryFileMutexDo(Int32 timeout, Action action)
   at� Microsoft.PowerShell.PSConsoleReadLine.WriteHistoryRange(Int32 start, Int32 end, Func`2 fileOpener)
   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, Can�cellationToken cancellationToken)

Steps to reproduce

use [Windows Key] + '.' to add an emoji
echo 🔥

Expected behavior

🔥

Actual behavior

�
Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new
@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Jun 7, 2020
@0xW1sKy
Copy link
Author

0xW1sKy commented Jun 7, 2020

so i was thinking more about this and realized this doesnt happen on my work computer (where i normally use emoji in my git commits.)

this is info for a working version:

Environment

PS version: 7.0.1
PSReadline version: 2.0.0
os: 10.0.17134.1 (WinBuild.160101.0800)
PS file version: 7.0.1.0
HostName: ConsoleHost
BufferWidth: 306
BufferHeight: 3000

@0xW1sKy
Copy link
Author

0xW1sKy commented Jun 7, 2020

maybe my version of windows it the issue.
changed to ps 7.0.1 release version and still have same issue on my personal machine.

PS version: 7.0.1
PSReadline version: 2.0.0
os: 10.0.19041.1 (WinBuild.160101.0800)
PS file version: 7.0.1.0
HostName: ConsoleHost
BufferWidth: 215
BufferHeight: 37

@rkeithhill
Copy link
Contributor

The Windows Emoji panel doesn't seem to insert emojis correctly into PS 7. Not sure where the problem lies. If you execute the following does it display 🔥 correctly?

"`u{1f525}"

@0xW1sKy
Copy link
Author

0xW1sKy commented Jun 7, 2020

"`u{1f525}" does properly display for me.

@rkeithhill
Copy link
Contributor

rkeithhill commented Jun 7, 2020

It seems to be that pasting into PS with emojis doesn't work right. If you copy to the clipboard the emoji that you just displayed using the Unicode escape string and then try to paste it back into PowerShell - it doesn't work. BTW, you can remove PSReadLine from this situation by running pwsh -noninteractive -noprofile and this issue reproduces. So someone should probably move this issue to the PowerShell repo. Even then, this may be a conhost issue. Yup, just fired up CMD.exe in it's one console window and this reproduces there. Looking more like a Windows/conhost.exe issue and not a PSRL/PowerShell issue. OK, see this issue in the WindowsTerminal repo (also repo for conhost) - microsoft/terminal#1503

@daxian-dbw
Copy link
Member

@rkeithhill Thanks for referencing the WT issue!
@0xW1sKy emojis are not well supported in PSReadLine today. Here are the related issue: #1329, #949
I will close this issue as a duplicate.

@ghost ghost removed the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Jun 10, 2020
@daxian-dbw daxian-dbw added the Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. label Jun 10, 2020
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