A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/nanodbc/nanodbc/issues/219 below:

Maybe lose tail data when access Mysql's VARCHAR field contained UTF8 string. · Issue #219 · nanodbc/nanodbc · GitHub

Environment Actual behavior

When access Mysql's VARCHAR(or CHAR) field contained UTF8 string, and the size (number of bytes) of UTF8 string is more than the size (number of characters) of VARCHAR(N) field, nanodbc only return the front N bytes and lose tail data. For Mysql's VARCHAR field, its bytes is variable, but through the function SQLDescribeCol (nanodbc.cpp:2724) only get the static max number of characters (sqlsize), and only copy sqlsize byte.
const char* s = col.pdata_ + rowset_position_ * col.clen_; (nanodbc.cpp:3021)

Expected behavior Minimal Working Example

E4 B8 96 E7 95 8C E4 BD A0 E5 A5 BD
This is four Chinese character string encoding by UTF8, 3 bytes per Chinese character. This string can storage in the VARCHAR(10) field of Mysql, but only read the first 10 bytes.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4