Pavan Nath
Pavan Nath

Reputation: 1494

How to create a table in mysql with unicode string as table name?

table_name: Jm™–Í€hÀÂ}#’Çʵf‹xãÈÜû,ÀD^Ð*

I want to create a table with table_name in mysql5. ID,NAME are the column names given in the table. Is it possible to create?

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\x0fJm\ufffd\x12\ufffd\u0340\x11h\ufffd\ufffd}#\ufffd\ufffd\u02b5\x0cf\ufffdx\ufffd\ufffd\ufffd\ufffd,\ufffdD^\ufffd* (ID INT,NAME VARCHAR(10),' at line 1")

Upvotes: 0

Views: 318

Answers (2)

Pavan Nath
Pavan Nath

Reputation: 1494

After puzzling alot, I simply converted the entire string into BASE32 format because its character set contains the values accepted as table name in MySQL but there should be a restriction on the length of the output string or else "=" will be appended at the end of the string.

Upvotes: 0

Rick James
Rick James

Reputation: 142208

Suggest that you take the HEX() of the encrypted string. This will avoid any nasty characters that could cause fatal errors -- such as space, zero byte, slash, backslash, quotes, backtic, ...

I checked on BASE64, but it has a potentially serious problem because it includes "/"

Upvotes: 1

Related Questions