System.Text.EncoderFallbackException: Unable to translate Unicode character \uD83D at index 14 to specified code page.
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- csharp, powershell, vscode
- Domaine
- cli, developer-experience
Piste de recherche
Reproduce the issue in the VS Code integrated PowerShell terminal using the filename and steps provided. Start with the PSReadLine history path shown in the exception, especially MaybeAddToHistory and WriteHistoryRange, and compare encoding behavior with the working Windows Terminal case. Done means Unicode paste and execution complete without an exception or character corruption.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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. Please report this bug with the details below.
Report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new
### Environment
PSReadLine: 2.0.0
PowerShell: 5.1.22621.6133
OS: Microsoft Windows 10.0.22631
Last 134 Keys
m a r k d Tab Spacebar F i n Tab Backspace Backspace Backspace . \ Spacebar F i n d i n g Spacebar E m u l a t o r . m d " Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+LeftArrow Ctrl+RightArrow LeftArrow LeftArrow LeftArrow " Enter
UpArrow Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace l s Enter
� Spacebar F i n d i n g Spacebar E m u l a t o r . m d " Home " Home m a r k d o w n l i n t Spacebar Enter
### Exception
System.Text.EncoderFallbackException: Unable to translate Unicode character \uD83D at index 14 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__DisplayClass83_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)
Screenshot
VSCode's folder view displays name correctly
VSCode integrated PowerShell command (auto-complete)
Filename is not displayed correctly, exception occurred when executing the command:
Outside PowerShell has no problem/issue
The issue only occurs when running PowerShell which is integrated to VS Code, "normal" PowerShell executed from File Explorer works even with the UNICODE character 🕮:
Environment data
### Windows Terminal / PowerShell (the working one)
PS Version: 5.1.22621.6133
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.0.0
PSReadLine EditMode: Windows
OS: 10.0.22621.1 (WinBuild.160101.0800)
BufferWidth: 120
BufferHeight: 30
### VS Code's integrated terminal (the buggy one)
PS Version: 5.1.22621.6133
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.0.0
PSReadLine EditMode: Windows
OS: 10.0.22621.1 (WinBuild.160101.0800)
BufferWidth: 120
BufferHeight: 30
Since they're the same the issue seems to be in the integration of PS into VS Code.
Steps to reproduce
- Open VS Code
- Select/mark file (F2, Ctrl+A, Ctrl+C)
🕮 Finding Emulator.mdin file tree view - Run
🕮 Finding Emulator.md(INFO: Here the filename is correct but in Terminal window it looks like:
Expected behavior
No exception: Copy&Paste should work with terminal window / VS Code; looks like they're using different encoding
Workaround: Type markdownlint and press until ‘🕮 Finding Emulator.md’ appears. If the folder contains many files, you’ll need multiple tab presses because VS Code’s tree view sorts differently than the terminal’s completion order.
Actual behavior
Copy&Paste inserts wrong UNICODE char + when executing the exception occurs.
- Langage dominant
- C#
- Étoiles
- 4.4k
- Forks
- 341
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de PowerShell/PSReadLine
-
Needs-Triage :mag:
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
PowerShell/PSReadLine#5205 ·
-
Needs-Triage :mag:
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
PowerShell/PSReadLine#5195 ·
-
Needs-Triage :mag:
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
PowerShell/PSReadLine#5121 ·
-
Needs-Triage :mag:
Difficulté 2/5 1-3 heures Accessibilité débutants 64/100
PowerShell/PSReadLine#5045 ·
-
Area-CommandHelp Issue-Enhancement
Difficulté 1/5 Moins d'une heure Accessibilité débutants 68/100
PowerShell/PSReadLine#3470 · 3 réactions ·
Toutes les issues de PowerShell/PSReadLine
Issues similaires
-
core dependencies
Difficulté 1/5 Moins d'une heure Accessibilité débutants 80/100
-
bug frontend good first issue
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
-
NavigationViewItemAutomationPeer implements IInvokeProvider but never advertises the Invoke pattern Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
unoplatform/uno#24629 ·
-
agentic-workflows Needs: Triage :mag: State: In-PR
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
-
Down / Waiting for removal
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100