CSV export fails on non-ascii characters

未關閉 適合新手
#314 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
62/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
postgresql, sql
領域
database

研究方向

從結果窗格中的「Save as CSV」動作開始,追蹤它如何將查詢結果寫入所選檔案;報告顯示,當結果包含西里爾字母或哈薩克語字元時,Windows 上會發生故障。使用提供的 SQL 查詢重現,並確認儲存成功,且 CSV 包含所有資料列,文字與結果窗格中的相同。

由索引模型根據 Issue 內容生成。

描述

Describe the bug

CSV export fails when the result set contains at least some non-ASCII characters anywhere in it (I work with russian and kazakh languages so I've experienced this issue with letters from those languages) .

The resulting csv file only contains data before the non-ASCII character.

To Reproduce

Steps to reproduce the behavior:

  1. Execute a query that returns rows containing non-ASCII characters:
    select * from (values
    ('ascii-characters'),
    ('А'), ('а'), ('Ә'), ('ә'), ('Б'), ('б'), ('В'), ('в'), ('Г'), ('г'),
    ('Ғ'), ('ғ'), ('Д'), ('д'), ('Е'), ('е'), ('Ё'), ('ё'), ('Ж'), ('ж'),
    ('З'), ('з'), ('И'), ('и'), ('Й'), ('й'), ('К'), ('к'), ('Қ'), ('қ'),
    ('Л'), ('л'), ('М'), ('м'), ('Н'), ('н'), ('Ң'), ('ң'), ('О'), ('о'),
    ('Ө'), ('ө'), ('П'), ('п'), ('Р'), ('р'), ('С'), ('с'), ('Т'), ('т'),
    ('У'), ('у'), ('Ұ'), ('ұ'), ('Ү'), ('ү'), ('Ф'), ('ф'), ('Х'), ('х'),
    ('Һ'), ('һ'), ('Ц'), ('ц'), ('Ч'), ('ч'), ('Ш'), ('ш'), ('Щ'), ('щ'),
    ('Ъ'), ('ъ'), ('Ы'), ('ы'), ('І'), ('і'), ('Ь'), ('ь'), ('Э'), ('э'),
    ('Ю'), ('ю'), ('Я'), ('я')
    ) as kz_alphabet(letter);
    
  2. In the results pane, click "Save as CSV" button and proceed saving the file
  3. See error (popup and in the output pane for the extension):

    Failed to save results. Failed to save vscode-export-test.csv: 'charmap' codec can't encode character '\u0410' in position 0: character maps to <undefined>

  4. Examine the file - it only contains data before non-ASCII characters appear in the query results:

    letter
    ascii-characters

Expected behavior

No error, popup indicating success shown, file contains all data rows, rows content is the same as in the query results pane

VS Code version

Version: 1.142.0 (system setup)
Commit: 6d62b1d5dace93a33b3a6d3eca1317bd5e15bcb1
Date: 2026-10-15T03:02:17Z
Electron: 43.7.7
ElectronBuildId: 15553055
Chromium: 150.0.7871.250
Node.js: 24.21.0
V8: 15.0.245.31-electron.0
@github/copilot: 1.0.95-0.unstable.r38345923974.g3754b70
@github/copilot-sdk: 1.0.19.38345923974.g3754b70
OS: Windows_NT x64 10.0.26200

Extension Logs

[1:21:27 PM] Started saving results to c:\path\to\query\results\vscode-export-test.csv
[1:21:27 PM] Failed to save results. Failed to save vscode-export-test.csv: 'charmap' codec can't encode character '\u0410' in position 0: character maps to

主要語言
沒有語言資料
星號
406
分支
35
平均合併
2 小時 47 分鐘
30 天內合併 PR
5

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

microsoft/vscode-pgsql 的其他 Issue

查看 microsoft/vscode-pgsql 的全部 Issue

相似的 Issue

更多 Databases Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。