Closed gmg137 closed 5 years ago
@gmg137 Have you solved it ?
@Koka When i open win10 utf-8 beta support, it works.
I viewed source and find something.
can we send a user encoded bytes (like gbk bytes) to sqlserver?
as following
fn prepare_bytes(&mut self, sql_bytes: &[u8]) -> Return<()> {
match unsafe {
ffi::SQLPrepare(
self.handle(),
sql_bytes.as_ptr(),
sql_bytes.len() as ffi::SQLINTEGER,
)
} {
ffi::SQL_SUCCESS => Return::Success(()),
ffi::SQL_SUCCESS_WITH_INFO => Return::SuccessWithInfo(()),
ffi::SQL_ERROR => Return::Error,
r => panic!("SQLPrepare returned unexpected result: {:?}", r),
}
}
@yuana1 没解决,我最后是直接把数据库返回数据换成英文了。。。推测是 odbc 的问题,因为我是相同的window sql server 数据库,在linux客户端下没问题,到windows客户端下就有问题了。。。。可能真是你说的那样,需要修改windows客户端的系统编码。
can we send a user encoded bytes (like gbk bytes) to sqlserver?
@yuana1 Thanks for your investigation! I have very little experience related to national encoding problems in Rust and have no ability to properly test such cases. It would be great if you could find places where non-utf8 support can be improved and prepare pull request with proposed fixes.
@Koka I will try it!
Fix published as 0.10.1
The database returns a Chinese string. Running normally under linux, but compiling and running under windows will report the following error: