cqpsdk-rust's People
cqpsdk-rust's Issues
CString Type casting
Currently we declare const char*
in C as *const u8
in Rust, however they are CString
, who ends with a \0
, and if you use CString
or CStr
to parse the bytes, they will ask for a *const i8
instead of *const u8
.
// My current way translating *const i8 into primitive str.
let msgText = std::str::from_utf8(std::ffi::CStr::from_ptr(msg).to_bytes()).unwrap();
Although the primitive str
's as_ptr
returns a *const u8
, and it is working in CQP and WinAPI, they are encoded in UTF-8
, while CQP and WinAPI use cp936
, which might lead to problems in the future.
So my idea is, replace all *const u8
with *const i8
, and use encoding
module to solve the encoding conflict.
If you have any idea about this, please don't hesitate to share.
What encoding
I use Sublime Text to compose Rust code, and it's nice when working with UTF-8
, however applications in Windows use non-Unicode encoding.
I am thinking about including an encoding
module to translate UTF-8
to cp936
when calling APIs, and our code sticks with UTF-8
, any ideas?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.