Closed natlibfi-arlehiko closed 4 years ago
So what is your database character set? And why are you not storing your data in that character set? Since UTF-8 (aka AL32UTF8 for Oracle) is a universal character set it should be perfectly capable of encoding all characters. The only time this won't work is if your database character set is A and you are attempting to store your data in character set B, and the conversion between character set A and B is such that there is no character mangling. Of course, it also means that you must use character set B as your client character set at all times or character mangling takes place. That seems to be what you are talking about. Can you clarify?
Please also provide an example. Include the create table statement and some insert statements and the Node.js code that demonstrates the problem.
我现在碰到一个情况,oracle server 用的US7ASCII ,客户端查询出来乱码,这个可以在连接数据库的时候直接设置字符集吗?
@lfpei yes, node-oracledb will let you query data from a DB that is running US7ASCII. There is no need to change the client character set.
@cjbj node-oracledb在链接数据库的时候需要修改什么配置?具体步骤麻烦告知下,谢谢
@lfpei there are no specific steps because node-oracledb always queries data in AL32UTF8 which can handle ASCII data. If you have a specific problem with your data then open a new issue. Give us a runnable test case including SQL to create table data. It is better if you translate to English because I don't speak Mandarin.
@natlibfi-arlehiko shouldn't you be using LONG RAW?
@cjbj What configuration do I need to write in the code to make the character set US7ASCII,and There is no way for the server connect to the Internet, and there is no test environment code
@cjbj How do i handle US7ASCII in nodejs code
@natlibfi-arlehiko shouldn't you be using LONG RAW?
Yes, of course :) But we cannot touch what our service does. We are only querying data and cannot affect how it's written to the database.
@lfpei it sounds like you have some confusion, or an example that needs more explanation. There is nothing special that normal use of US7ASCII data from the DB would need. Please open a new issue.
@natlibfi-arlehiko we'll discuss adding an option, but personally I'm not in favor of extra complexity in node-oracledb just because a data model wasn't correctly chosen. The complexity and all the resultant testing (effectively more than doubling our test load) would need to be carried forward for all future versions so it's a significant change. You can help by providing the testcase that @anthony-tuininga asked for, to make sure we really understand what you want.
@cjbj I've created a new problem.
@natlibfi-arlehiko we discussed this and have no plans to change from a fixed AL32UTF8.
@cjbj Ok. But I'll still try to provide an example to further clarify this.
Closing - there are no plans to move from the default character set.
Review existing enhancement requests
Describe your new request in detail Currently,
node-oracle
has a static client charset (Node-oracledb always uses Oracle’s AL32UTF8 character set internally.). We have a problem with this since our DB has character data in LONG column which gets automatically converted to string. Since we cannot set the charset the UTF-8 data gets converted incorrectly.Our workaround was to fork node-oracledb and odpi and change the default charset.
It'd be better if the
node-oracledb
would support setting the charset. I can create a PR if given directions how, and where this enhancement should be implemented.Related issues: #223 , #533 #132 , #62