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

Add option to set character set #1172

Closed
natlibfi-arlehiko opened this issue Nov 4, 2019 · 15 comments
Closed

Add option to set character set #1172

natlibfi-arlehiko opened this issue Nov 4, 2019 · 15 comments

Comments

@natlibfi-arlehiko
Copy link

  1. Review existing enhancement requests

  2. 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

  1. Give supporting information about tools and operating systems. Give relevant product version numbers
    node-oracledb: 4.0.1
@anthony-tuininga
Copy link
Member

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?

@anthony-tuininga
Copy link
Member

Please also provide an example. Include the create table statement and some insert statements and the Node.js code that demonstrates the problem.

@lfpei
Copy link

lfpei commented Nov 6, 2019

我现在碰到一个情况,oracle server 用的US7ASCII ,客户端查询出来乱码,这个可以在连接数据库的时候直接设置字符集吗?

@cjbj
Copy link
Member

cjbj commented Nov 6, 2019

@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.

@lfpei
Copy link

lfpei commented Nov 6, 2019

@cjbj node-oracledb在链接数据库的时候需要修改什么配置?具体步骤麻烦告知下,谢谢

@cjbj
Copy link
Member

cjbj commented Nov 6, 2019

@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.

@cjbj
Copy link
Member

cjbj commented Nov 6, 2019

@natlibfi-arlehiko shouldn't you be using LONG RAW?

@lfpei
Copy link

lfpei commented Nov 6, 2019

@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

@lfpei
Copy link

lfpei commented Nov 6, 2019

@cjbj How do i handle US7ASCII in nodejs code

@natlibfi-arlehiko
Copy link
Author

natlibfi-arlehiko commented Nov 6, 2019

@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.

@cjbj
Copy link
Member

cjbj commented Nov 6, 2019

@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.

@lfpei
Copy link

lfpei commented Nov 7, 2019

@cjbj I've created a new problem.
#1175

@cjbj
Copy link
Member

cjbj commented Nov 9, 2019

@natlibfi-arlehiko we discussed this and have no plans to change from a fixed AL32UTF8.

@natlibfi-arlehiko
Copy link
Author

@cjbj Ok. But I'll still try to provide an example to further clarify this.

@cjbj
Copy link
Member

cjbj commented Mar 7, 2020

Closing - there are no plans to move from the default character set.

@cjbj cjbj closed this as completed Mar 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants