Hot answers tagged encoding
5
Well, the trick is that a database can only specify which "locale" it is used for at creation time. When you create a database you either specify what you want by specifying the codeset, territory and collation (example CREATE DATABASE MYDB AUTOMATIC STORAGE YES ON '/data' DBPATH ON '/dbdir' USING CODESET UTF-8 TERRITORY US COLLATE USING SYSTEM), or you let ...
2
The solution isn't precisely the same but this question is where I originally found direction for a similar issue and the concepts there should take you where you want to go. MySQL has a BINARY character set and from all appearances, by converting through it, you can prevent MySQL from realizing what you're actually doing and being "too helpful."
Test case ...
1
The backslash \ is the default escape character in the (default) text format of COPY. The format you describe is recognized as (quoting the manual here)
backslash sequences are recognized by COPY FROM
...
\xdigits | Backslash x followed by one or two hex digits specifies the character with that numeric code
.. which seems to be just as intended.
...
1
I found a solution, for everyone to know:
Assuming that we put the xml field in a variable of type varchar(max) and then casting it to a variable of type XML (but not by using the CONVERT function, rather just by simple assignment), in the end the value of the newly created XML variable will be included in an insert query, by casting it back to ...
1
After some trial and error, I've learned how and where to apply COLLATE:
Converted lines like:
SELECT SOMETHING
FROM SOMEWHERE
WHERE table_schema = given_database
AND table_name = given_table
AND index_name = given_index;
To:
SELECT SOMETHING
FROM SOMEWHERE
WHERE table_schema COLLATE utf8_unicode_ci = given_database
AND table_name COLLATE ...
Only top voted, non community-wiki answers of a minimum length are eligible