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

Query result contains wrong key when column name is CJK character #641

Open
yelusaku opened this issue Mar 7, 2017 · 2 comments
Open

Query result contains wrong key when column name is CJK character #641

yelusaku opened this issue Mar 7, 2017 · 2 comments

Comments

@yelusaku
Copy link

yelusaku commented Mar 7, 2017

Create table sql string: "CREATE TABLE IF NOT EXISTS test_table (id integer primary key, '\u540D\u5B57' text, data_num integer))",
insert data sql string: "INSERT INTO test_table ('\u540D\u5B57', data_num) VALUES ('周杰伦', 100)",
query result: {"data_num":100,"id":1,"ÂêçÂ≠ó":"周杰伦"} ,
the key "名字" should be "u540D\u5B57".

@yelusaku
Copy link
Author

yelusaku commented Mar 7, 2017

I tried to modified the file SQLitePlugin.m in src/ios directory, line 387:
//columnName = [NSString stringWithFormat:@"%s", sqlite3_column_name(statement, i)];
columnName = [[NSString alloc] initWithBytes:(char *)sqlite3_column_name(statement, i)
length:strlen(sqlite3_column_name(statement, i))
encoding:NSUTF8StringEncoding];
#if !__has_feature(objc_arc)
[columnName autorelease];
#endif,
and it worked.

@brodycj
Copy link
Contributor

brodycj commented Mar 8, 2017

Thanks @yelusaku. As I said in #642 I will test on other platforms before integrating. It may take me a few weeks due to some existing workload.

This was referenced Jan 16, 2018
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

2 participants