Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

code page problem #27

Closed
orenz opened this Issue · 19 comments

2 participants

@orenz

I use Hebrew code page on mysql.
English letters are Ok, however Hebrew letters come out wrong.
When I use mysql native driver all is OK.
I guess all non UFT8 code pages has the same problem.

@wankdanker
Collaborator

Hi @orenz.

What does your connection string look like? Have you tried specifying the charset connection parameter? (http://dev.mysql.com/doc/refman/5.0/en/connector-odbc-configuration-connection-parameters.html)

@orenz
@wankdanker
Collaborator

OK. I will have to research this. We just use SQLGetData(..., buffer, ...) to get the values from ODBC and then String::New(buffer). I'm not sure what needs to be done so that V8 will play nice with other code pages.

@wankdanker
Collaborator

The issue might be that we were specifying SQL_CHAR for TargetType in the case of

SQLRETURN SQLGetData(
    SQLHSTMT       StatementHandle,
    SQLUSMALLINT   Col_or_Param_Num,
    SQLSMALLINT    TargetType,
    SQLPOINTER     TargetValuePtr,
    SQLLEN         BufferLength,
    SQLLEN *       StrLen_or_IndPtr);

Better results might be had if using SQL_C_WCHAR, but I am not sure. I have tried testing this against my MSSQL server which has some Hebrew characters in an NVARCHAR field, but am not getting those same characters back. Not sure where the problem lies.

If you have working C++ ODBC code, what does your SQLGetData() call look like?

@wankdanker
Collaborator

OK, I think I have resolved this issue; at least as far as my tests go. It's going to have to cook for a while though before it makes its way to a release.

The issue was a combination of previously using SQL_CHAR for the TargetType and the buffer being a char* buffer which has been changed to uint16_t* buffer

You can get the code from my v0.4-separation branch:

https://github.com/wankdanker/node-odbc/tree/v0.4-separation

@orenz
@orenz

Hi
I want to check this fix now. how do I install this:
https://github.com/wankdanker/node-odbc/tree/v0.4-separation

@wankdanker
Collaborator

Hi @orenz,

You can use npm to install from git repositories if you are on a system that has git; like this:

npm install git://github.com/wankdanker/node-odbc.git#v0.4-separation

Where everything after the # is a branch, tag or commit hash.

It would be nice if you would test the v0.5 branch also/instead. That version has a test runner and some tests which include a Unicode test that may be related to your issue.

npm install git://github.com/wankdanker/node-odbc.git#v0.5

If you are on Windows, you will have to grab a zip file from github of the branch or tag. Here is a link to the v0.5 zip file:

https://github.com/wankdanker/node-odbc/archive/v0.5.zip

Hope this helps,

Dan

@orenz
@wankdanker
Collaborator

run npm install to pull in the bindings module.

@orenz
@wankdanker
Collaborator

I'm not sure if I understand what you are asking. But you could also install the bindings module by downloading a zip file from github (https://github.com/TooTallNate/node-bindings/archive/master.zip) and placing the contents in your-odbc-folder/node_modules/bindings

@orenz
@wankdanker
Collaborator

Hi @orenz,

It should include the fix and it work OK for me. But, I may be missing something.

Could you post your MySQL Create Table statement, some insert statements and your select statement for your test case? We need to get on the same page so I can see what is going on.

Thanks,

Dan

@wankdanker
Collaborator

I created a quick test case of my own and had to use charset=utf8 in the connection string to get it to work.

@orenz
@orenz
@wankdanker
Collaborator

Hey @orenz, if you are still having this issue, try installing with npm install git://github.com/wankdanker/node-odbc.git or npm install https://github.com/wankdanker/node-odbc/archive/v0.5.16.tar.gz and let me know how it goes.

Thanks,

Dan

@wankdanker
Collaborator

This may or may not be fixed here: https://github.com/wankdanker/node-odbc/tree/v0.5.17.

Going to close this issue due to inactivity.

@wankdanker wankdanker closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.