Closed liutongwei closed 6 years ago
I can not really reproduce any issues with unicode? I adjusted your example slightly to fix a issue with the async code in your node.js example. I also return aa after the assignment in the q code.
nodeq.connect({ host: "localhost", port: 5000 }, function(err, con) {
if (err) throw err;
console.log("connected");
con.k('aa:`$"你好"; aa', function(err, res) {
if (err) throw err;
console.log("result", res);
con.close(function() {
console.log("con closed");
});
});
});
outputs
connected
result 你好
con closed
what return do you expect from a variable assignment?
Hi, @michaelwittig Thanks for your reply.
I could receive the same output as your reply from node side. But when I typed aa
in q terminal, it returned with 浣犲ソ
.
The problem is that I would like to read a .csv
file in q which contains unicode like Chinese characters, using the code:
CstInfo:("sdsssbsssssfs"; 1# ",")0: `CustomerInfo.csv
And it returns with the CstInfo
correctly like below:
But when I use the nodeq command to fetch data from CstInfo
:
nodeq.connect({ host: "localhost", port: 5000 }, function(err, con) {
if (err) throw err;
console.log("connected");
con.k('1# select from CstInfo', function(err, res) {
if (err) throw err;
console.log("result", res);
con.close(function() {
console.log("con closed");
});
});
});
The output does not show correctly, seen the content surrounded by red lines (sorry for the mask):
So is there any method I could take to solve this problem?
Thanks again for your reply.
couldyou provide my one of those CstNames that is not working as text? I can not extract the test data from the image easily.
Hi, @michaelwittig. Thanks for your reply. I am sorry that I forgot to attach the csv file. Here is the CustomerInfo.csv
which contains Chinese characters. Maybe you could open it with charset GBK
to see the correct demonstration as shown in the image above.
And you could just copy the unicode string 广发证券股份有限公司(OTC)
to clipboard to use these characters.
It is so kind of you to spend your time on this problem.
Hi, @michaelwittig.
Now I can solve the charset problem. The reason is because I save the .csv
file using charset GBK
. When I save it with charset Unicode
, the output shows correctly.
But the Unicode string could not be shown as what it should be in the q terminal.
This is a very tricky problem. I think it is not about node-q, but I should deal with q
.
Thank you so much. I do appreciate your time.
Examples:
But when I look at the variable
aa
in q, it returns with a totally different string:`浣犲ソ
How could I solve this problem?