ClickHouse/tests/queries/0_stateless/00436_convert_charset.sql
Azat Khuzhin 0324770773 Remove all trailing whitespaces in tests
sed -r -i \
    -e 's/SELECT $/SELECT/' \
    -e 's/SELECT DISTINCT $/SELECT DISTINCT/' \
    -e 's/WITH $/WITH/' \ # zero matches, new test will be added
    -e 's/ARRAY JOIN $/ARRAY JOIN/' \
    -e 's/GROUP BY $/GROUP BY/' \
    -e 's/ORDER BY $/ORDER BY/' \
    -e 's/LIMIT ([0-9]+) BY $/LIMIT \1 BY/' \ # zero matches, new test will be added
    tests/queries/*/*.sql \
    tests/queries/*/*.reference

(With except for tests/queries/0_stateless/00751_default_databasename_for_view.reference)
2020-09-09 01:36:58 +03:00

30 lines
1.6 KiB
SQL

SELECT
'абвгдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ' AS orig,
hex(convertCharset(orig, 'utf-8', 'cp1251') AS cp1251) AS cp1251_hex,
hex(convertCharset(orig, 'utf-8', 'utf-7')) AS utf7_hex,
hex(convertCharset(orig, 'utf-8', 'bocu-1')) AS bocu1_hex,
hex(convertCharset(orig, 'utf-8', 'scsu')) AS scsu_hex,
convertCharset(cp1251, 'cp1251', 'utf-8') AS orig2,
convertCharset(orig, 'cp1251', 'utf8') AS broken1,
convertCharset(orig, 'latin1', 'utf8') AS broken2,
convertCharset(orig, 'koi8-r', 'utf8') AS broken3,
convertCharset(broken1, 'utf-8', 'cp1251') AS restored1,
convertCharset(broken2, 'utf-8', 'latin1') AS restored2,
convertCharset(broken3, 'utf-8', 'koi8-r') AS restored3
FORMAT Vertical;
SELECT
materialize('абвгдеёжзийклмнопрстуфхцчшщъыьэюяАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ') AS orig,
hex(convertCharset(orig, 'utf-8', 'cp1251') AS cp1251) AS cp1251_hex,
hex(convertCharset(orig, 'utf-8', 'utf-7')) AS utf7_hex,
hex(convertCharset(orig, 'utf-8', 'bocu-1')) AS bocu1_hex,
hex(convertCharset(orig, 'utf-8', 'scsu')) AS scsu_hex,
convertCharset(cp1251, 'cp1251', 'utf-8') AS orig2,
convertCharset(orig, 'cp1251', 'utf8') AS broken1,
convertCharset(orig, 'latin1', 'utf8') AS broken2,
convertCharset(orig, 'koi8-r', 'utf8') AS broken3,
convertCharset(broken1, 'utf-8', 'cp1251') AS restored1,
convertCharset(broken2, 'utf-8', 'latin1') AS restored2,
convertCharset(broken3, 'utf-8', 'koi8-r') AS restored3
FORMAT Vertical;