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

Error when using unicode characters (e.g. 👍) #1009

Closed
autoantwort opened this issue Aug 25, 2019 · 1 comment
Closed

Error when using unicode characters (e.g. 👍) #1009

autoantwort opened this issue Aug 25, 2019 · 1 comment

Comments

@autoantwort
Copy link

I entered echo "👍" and get the error:

Last 9 Keys:
 e c h o Space "" Enter


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

I copied the emoji from here and pasted it in the powershell.

Environment data

PS version: 5.1.18362.145
PSReadline version: 2.0.0-beta2
os: 10.0.18362.290 (WinBuild.160101.0800)
PS file version: 10.0.18362.290 (WinBuild.160101.0800)
BufferWidth: 120
BufferHeight: 3000

@autoantwort
Copy link
Author

autoantwort commented Aug 25, 2019

Sorry its a duplicate of #949.

kai2nenobu added a commit to kai2nenobu/dotfiles that referenced this issue Mar 12, 2020
まだ日本語を含む履歴はうまく検索できない。
というのも履歴ファイル自体はUTF-8で保存されてるのだが、powershellの
パイプでいつの間にかエンコードが変わってたりする。

    $OutputEncoding = [Text.Encoding]::UTF8

にすることで、fzfの絞り込み画面で日本語を表示することは出来た。
しかし実際に日本語を含む履歴を選択すると、
文字化けした文字がプロンプトに挿入されてしまう。

多分PSReadline側の問題っぽい。

- <PowerShell/PSReadLine#1009>
kai2nenobu referenced this issue in kai2nenobu/dotfiles Mar 12, 2020
まだ日本語を含む履歴はうまく検索できない。
というのも履歴ファイル自体はUTF-8で保存されてるのだが、powershellの
パイプでいつの間にかエンコードが変わってたりする。

    $OutputEncoding = [Text.Encoding]::UTF8

にすることで、fzfの絞り込み画面で日本語を表示することは出来た。
しかし実際に日本語を含む履歴を選択すると、
文字化けした文字がプロンプトに挿入されてしまう。

多分PSReadline側の問題っぽい。

- `https://github.com/PowerShell/PSReadLine/issues/1009`
kai2nenobu added a commit to kai2nenobu/dotfiles that referenced this issue Mar 12, 2020
まだ日本語を含む履歴はうまく検索できない。
というのも履歴ファイル自体はUTF-8で保存されてるのだが、powershellの
パイプでいつの間にかエンコードが変わってたりする。

    $OutputEncoding = [Text.Encoding]::UTF8

にすることで、fzfの絞り込み画面で日本語を表示することは出来た。
しかし実際に日本語を含む履歴を選択すると、
文字化けした文字がプロンプトに挿入されてしまう。

多分PSReadline側の問題っぽい。

- https://<span></span>github.com/PowerShell/PSReadLine/issues/1009
kai2nenobu referenced this issue in kai2nenobu/dotfiles Mar 12, 2020
まだ日本語を含む履歴はうまく検索できない。
というのも履歴ファイル自体はUTF-8で保存されてるのだが、powershellの
パイプでいつの間にかエンコードが変わってたりする。

    $OutputEncoding = [Text.Encoding]::UTF8

にすることで、fzfの絞り込み画面で日本語を表示することは出来た。
しかし実際に日本語を含む履歴を選択すると、
文字化けした文字がプロンプトに挿入されてしまう。

多分PSReadline側の問題っぽい。

- <span>https://github.com/PowerShell/PSReadLine/issues/1009</span>
kai2nenobu added a commit to kai2nenobu/dotfiles that referenced this issue Mar 12, 2020
まだ日本語を含む履歴はうまく検索できない。
というのも履歴ファイル自体はUTF-8で保存されてるのだが、powershellの
パイプでいつの間にかエンコードが変わってたりする。

    $OutputEncoding = [Text.Encoding]::UTF8

にすることで、fzfの絞り込み画面で日本語を表示することは出来た。
しかし実際に日本語を含む履歴を選択すると、
文字化けした文字がプロンプトに挿入されてしまう。

多分PSReadline側の問題っぽい。

- PowerShell/PSReadLine#1009
kai2nenobu added a commit to kai2nenobu/dotfiles that referenced this issue Aug 11, 2020
まだ日本語を含む履歴はうまく検索できない。
というのも履歴ファイル自体はUTF-8で保存されてるのだが、powershellの
パイプでいつの間にかエンコードが変わってたりする。

    $OutputEncoding = [Text.Encoding]::UTF8

にすることで、fzfの絞り込み画面で日本語を表示することは出来た。
しかし実際に日本語を含む履歴を選択すると、
文字化けした文字がプロンプトに挿入されてしまう。

多分PSReadline側の問題っぽい。

- PowerShell/PSReadLine#1009
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

1 participant