python - Writing with Python Greek letters to (Oracle) SQL file doesn't work
问题描述
I'm trying to write Greek letters to file with ".sql" extension. But the result in the file are not correct.
The code in Python:
with open('test.sql', 'w', encoding='utf-8') as test_file:
test_file.write('DH5α\n')
In the SQL file I get:
DH5α
Any way I can solve this?
OS is windows
Thanks.
解决方案
正如评论中所写,问题出在 sql-developer 本身,它默认不使用 utf-8 编码。
推荐阅读
- angular6 - 如何在 angular google chart-angular 2+ 中获取数据事件点击
- ios - 尝试将 maximumValue 设置为 UISlider 时应用程序崩溃
- javascript - 无法通过 mockData 搜索
- d3.js - 无法重置焦点顺序条形图
- javascript - React 组件道具不会随 redux 商店更新
- javascript - 使用 React Native PanGestureHandler 从下到上移动框
- arrays - 使用矢量化方法而不是 FOR 循环创建多维移位数组
- typescript - 验证数字精度的“真实”浮点字段
- php - 在 Symfony 控制器上调用“addFlash”方法后在数据库中保存 flash 消息
- python-sphinx - 忽略 sphinx 项目 URL 路径中的文档文件夹