c++ - Cross-platform mySQL inconsistencies with character sets -
i have script creates database, couple of tables in , populates data. script made sqlite database on windows. 1 of tables in script named "abcß" ("abc+alt225").
next tried load script mysql thru mysql workbench. both server , workbench running on linux.
after fixing syntax inconsistencies database created. tried query database , tables. tables queried successfully, 1 above.
trying query "information_table.tables.table_name", name "abc\0d-61\0d63" gives different result original name. because of program crashing when run because sent table name codecvt_utf-8 encoder.
the database , tables created default encoding.
does know why i'm not seeing proper results?
but importantly - presume program crashing because of characters outside of wchar_t/utf-8 encoding. i'm curious - should use convert sequence std::wstring?
tia!
edit:
the code follows:
class mysqldatabase { public: int loaddatabasedata(); protected: struct mysqlimpl; mysqlimpl *m_pimpl; }; struct mysqldatabase::mysqlimpl { std::wstring_convert<std::codecvt_utf8<wchar_t> > m_myconv; }; int mysqldatabase::loaddatabasedata() { const char *table_name; std::wstring tablename = m_pimpl->m_myconv.from_bytes( table_name ); }
edit2:
do think work if add:
std::wstring_convert<std::codecvt_utf16<wchar_t> > m_myconv;
?
edit3:
here see in workbench:
# table_catalog, table_schema, table_name, table_type, engine, version, row_format, table_rows, avg_row_length, data_length, max_data_length, index_length, data_free, auto_increment, create_time, update_time, check_time, table_collation, checksum, create_options, table_comment 'def', 'draft', 'abcÃ', 'base table', 'innodb', '10', 'compact', '0', '0', '16384', '0', '0', '0', null, '2016-12-09 00:15:27', null, null, 'utf8_general_ci', null, '', ''
do not use utf-16 anything.
do not use "unicode".
where heck did \0d-61
come from?
do not use conversion subroutines, go source , make sure encoded utf-8.
for verifying using utf-8, abcß
hex 61 62 63 c39f
Comments
Post a Comment