Bug #71088 Support Unicode Strings

Submitted: 5 Dec 2013 8:19 Modified: 6 Dec 2013 9:00
Reporter: Peter Schäfer Email Updates:
Status: Open Impact on me:
None 
Category:Connector / C++ Severity:S4 (Feature request)
Version: OS:Any
Assigned to: CPU Architecture:Any

[5 Dec 2013 8:19] Peter Schäfer
Description:
Connector C++ uses 8-bit character strings (std::string).
It would be helpful to retrieve and store wide-character strings (std::wstring).

How to repeat:
(feature request)

Suggested fix:
Implement
std::wstring ResultSet::getWString(...)
PreparedStatement::setWString(...)
[6 Dec 2013 8:37] Peter Schäfer
Just did some research into MySQL character sets.
The character set for results can be set with
 SET SESSION character_set_results=ucs2
or
 SET SESSION character_set_results=utf16 
 SET SESSION character_set_results=utf16le 

Unforutnately, it doesn't work for prepared statements :-(
 SET SESSION character_set_client=ucs2
 SET SESSION character_set_client=utf16
fails with a meaningless error.

Seems like character_set_client must be an 8-byte encoding,
and unicode strings must be re-encoded as utf-8, *even if*
the database can store ucs2. 
Disapppointing...
[6 Dec 2013 9:00] Peter Schäfer
One more problem: 
 SET SESSION character_set_results=utf16 

will throw:
 SQLException("Server sent uknown charsetnr. Please report");

utf16 is not defined in mysql_util.cpp

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.