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 摘要。