Skip to content

Powershell Bug $lists | ? { $_.DisplayName -eq '�Hábito' }  #4261

@BraunerSabino

Description

@BraunerSabino

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

After:
$userid = '[email protected]'
$lists = Get-MgUserTodoList -UserId $userid
$lists | ? { $_.DisplayName -eq '�Hábito' }


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: 2024.4.0
OS: Microsoft Windows 10.0.22631
BufferWidth: 200
BufferHeight: 23

Last 200 Keys:

 Backspace Backspace Backspace Backspace Backspace t o Tab Tab Tab Tab Tab Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace $ l i s Tab Tab Backspace Enter
 UpArrow Spacebar 0 Backspace - u s Tab Spacebar $ u s e r Tab Enter
 $ l i s t Enter
 UpArrow UpArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow s [ 0 ] . i d Enter    
 UpArrow Ctrl+LeftArrow Ctrl+LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow Shift+End Delete Ctrl+LeftArrow LeftArrow RightArrow Shift+Home Delete Enter     
 UpArrow Spacebar | Spacebar ? Spacebar { Spacebar D i s Backspace Backspace Backspace $ _ . Backspace Backspace Backspace Backspace Backspace n a m e Spacebar - e q Spacebar H á b i t o Enter        
 UpArrow ' Ctrl+LeftArrow ' Enter
 UpArrow Backspace Backspace Backspace Backspace Backspace Backspace Backspace � H á b i t o ' Enter
 Enter
 UpArrow Enter
 UpArrow Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow Shift+End Delete Enter
 UpArrow UpArrow Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+LeftArrow D i s p l a y N Delete Enter
 Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+LeftArrow $ _ . Ctrl+LeftArrow { Spacebar End Spacebar } Enter


### Exception

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

PS Version: 7.4.6
PS HostName: Visual Studio Code Host
PSReadLine Version: 2.4.0-beta0
PSReadLine EditMode: Windows
OS: 10.0.22621.4455 (WinBuild.160101.0800)
BufferWidth: 200
BufferHeight: 23

Steps to reproduce

$userid = '[email protected]'
$lists = Get-MgUserTodoList -UserId $userid
$lists | ? { $_.DisplayName -eq '�Hábito' }

Expected behavior

Show the list

Actual behavior

Error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-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