Commit 966d22b7 authored by anson1014's avatar anson1014 Committed by GitHub

Ensure that source files contain only valid UTF8 encodings (#2188)

Modern software (including text editors, static analysis software,
and web-based code review interfaces) often requires source code files
to be interpretable via a consistent character encoding, with UTF-8 or
ASCII (a strict subset of UTF-8) as the default. Several of the MariaDB
source files contain bytes that are not valid in either the UTF-8 or
ASCII encodings, but instead represent strings encoded in the
ISO-8859-1/Latin-1 or ISO-8859-2/Latin-2 encodings.

These inconsistent encodings may prevent software from correctly
presenting or processing such files. Converting all source files to
valid UTF8 characters will ensure correct handling.

Comments written in Czech were replaced with lightly-corrected
translations from Google Translate. Additionally, comments describing
the proper handling of special characters were changed so that the
comments are now purely UTF8.

All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer
Amazon Web Services, Inc.
Co-authored-by: default avatarAndrew Hutchings <andrew@linuxjedi.co.uk>
parent 0fbcb0a2
...@@ -92,7 +92,7 @@ extern "C" FILE *my_win_popen(const char *cmd, const char *mode) ...@@ -92,7 +92,7 @@ extern "C" FILE *my_win_popen(const char *cmd, const char *mode)
goto error; goto error;
break; break;
default: default:
/* Unknown mode, xpected "r", "rt", "w", "wt" */ /* Unknown mode, expected "r", "rt", "w", "wt" */
abort(); abort();
} }
if (!SetHandleInformation(parent_pipe_end, HANDLE_FLAG_INHERIT, 0)) if (!SetHandleInformation(parent_pipe_end, HANDLE_FLAG_INHERIT, 0))
......
...@@ -642,7 +642,6 @@ bool DOMNODELIST::DropItem(PGLOBAL g, int n) ...@@ -642,7 +642,6 @@ bool DOMNODELIST::DropItem(PGLOBAL g, int n)
if (Listp == NULL || Listp->length < n) if (Listp == NULL || Listp->length < n)
return true; return true;
//Listp->item[n] = NULL; La proprit n'a pas de mthode 'set'
return false; return false;
} // end of DeleteItem } // end of DeleteItem
......
...@@ -23,13 +23,13 @@ ...@@ -23,13 +23,13 @@
solution was needed than the one-to-one conversion table. To solution was needed than the one-to-one conversion table. To
note a few, here is an example of a Czech sorting sequence: note a few, here is an example of a Czech sorting sequence:
co < hlaska < hláska < hlava < chlapec < krtek co < hlaska < hláska < hlava < chlapec < krtek
It because some of the rules are: double char 'ch' is sorted It because some of the rules are: double char 'ch' is sorted
between 'h' and 'i'. Accented character 'á' (a with acute) is between 'h' and 'i'. Accented character 'á' (a with acute) is
sorted after 'a' and before 'b', but only if the word is sorted after 'a' and before 'b', but only if the word is
otherwise the same. However, because 's' is sorted before 'v' otherwise the same. However, because 's' is sorted before 'v'
in hlava, the accentness of 'á' is overridden. There are many in hlava, the accentness of 'á' is overridden. There are many
more rules. more rules.
This file defines functions my_strxfrm and my_strcoll for This file defines functions my_strxfrm and my_strcoll for
...@@ -42,8 +42,9 @@ ...@@ -42,8 +42,9 @@
passes, that's why we need four times more space for expanded passes, that's why we need four times more space for expanded
string. string.
This file also contains the ISO-Latin-2 definitions of The non-ASCII literal strings in this file are encoded
characters. in the iso-8859-2 / latin-2 character set
(https://en.wikipedia.org/wiki/ISO/IEC_8859-2)
Author: (c) 1997--1998 Jan Pazdziora, adelton@fi.muni.cz Author: (c) 1997--1998 Jan Pazdziora, adelton@fi.muni.cz
Jan Pazdziora has a shared copyright for this code Jan Pazdziora has a shared copyright for this code
...@@ -112,7 +113,7 @@ static const struct wordvalue doubles[] = { ...@@ -112,7 +113,7 @@ static const struct wordvalue doubles[] = {
}; };
/* /*
Unformal description of the algorithm: Informal description of the algorithm:
We walk the string left to right. We walk the string left to right.
...@@ -127,7 +128,7 @@ static const struct wordvalue doubles[] = { ...@@ -127,7 +128,7 @@ static const struct wordvalue doubles[] = {
End of pass is marked with value 1 on the output. End of pass is marked with value 1 on the output.
For each character, we read it's value from the table. For each character, we read its value from the table.
If the value is ignore (0), we go straight to the next character. If the value is ignore (0), we go straight to the next character.
...@@ -139,31 +140,6 @@ static const struct wordvalue doubles[] = { ...@@ -139,31 +140,6 @@ static const struct wordvalue doubles[] = {
exists behind it, find its value. exists behind it, find its value.
We append 0 to the end. We append 0 to the end.
---
Neformální popis algoritmu:
Procházíme øetìzec zleva doprava.
Konec øetìzce je pøedán buï jako parametr, nebo je to *p == 0.
Toto je o¹etøeno makrem IS_END.
Pokud jsme do¹li na konec øetìzce pøi prùchodu 0, nejdeme na
zaèátek, ale na ulo¾enou pozici, proto¾e první a druhý prùchod
bì¾í souèasnì.
Konec vstupu (prùchodu) oznaèíme na výstupu hodnotou 1.
Pro ka¾dý znak øetìzce naèteme hodnotu z tøídící tabulky.
Jde-li o hodnotu ignorovat (0), skoèíme ihned na dal¹í znak..
Jde-li o hodnotu konec slova (2) a je to prùchod 0 nebo 1,
pøeskoèíme v¹echny dal¹í 0 -- 2 a prohodíme prùchody.
Jde-li o kompozitní znak (255), otestujeme, zda následuje
správný do dvojice, dohledáme správnou hodnotu.
Na konci pøipojíme znak 0
*/ */
#define ADD_TO_RESULT(dest, len, totlen, value) \ #define ADD_TO_RESULT(dest, len, totlen, value) \
...@@ -336,24 +312,23 @@ my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)), ...@@ -336,24 +312,23 @@ my_strnxfrm_czech(CHARSET_INFO *cs __attribute__((unused)),
/* /*
Neformální popis algoritmu: Informal description of the algorithm:
procházíme øetìzec zleva doprava we pass the chain from left to right
konec øetìzce poznáme podle *p == 0 we know the end of the string by *p == 0
pokud jsme do¹li na konec øetìzce pøi prùchodu 0, nejdeme na if we reached the end of the string on transition 0, then we don't go to
zaèátek, ale na ulo¾enou pozici, proto¾e první a druhý start, but to the saved position, because the first and second
prùchod bì¾í souèasnì the passage runs concurrently
konec vstupu (prùchodu) oznaèíme na výstupu hodnotou 1 we mark the end of the input (transition) with the value 1 on the output
naèteme hodnotu z tøídící tabulky then we load the value from the sorting table
jde-li o hodnotu ignorovat (0), skoèíme na dal¹í prùchod if the value is ignore (0), we jump to the next pass
jde-li o hodnotu konec slova (2) a je to prùchod 0 nebo 1, if the value is the end of the word (2) and it is a 0 or 1 transition,
pøeskoèíme v¹echny dal¹í 0 -- 2 a prohodíme we skip all the other 0 -- 2 and switch transitions
prùchody if it is a composite character (255), we test whether it follows
jde-li o kompozitní znak (255), otestujeme, zda následuje correct to the pair, we find the correct value
správný do dvojice, dohledáme správnou hodnotu
then we add the character 0 at the end
na konci pøipojíme znak 0
*/ */
......
...@@ -504,19 +504,19 @@ struct charset_info_st my_charset_latin1_nopad= ...@@ -504,19 +504,19 @@ struct charset_info_st my_charset_latin1_nopad=
* *
* The modern sort order is used, where: * The modern sort order is used, where:
* *
* '' -> "ae" * 'ä' -> "ae"
* '' -> "oe" * 'ö' -> "oe"
* '' -> "ue" * 'ü' -> "ue"
* '' -> "ss" * 'ß' -> "ss"
*/ */
/* /*
* This is a simple latin1 mapping table, which maps all accented * This is a simple latin1 mapping table, which maps all accented
* characters to their non-accented equivalents. Note: in this * characters to their non-accented equivalents. Note: in this
* table, '' is mapped to 'A', '' is mapped to 'Y', etc. - all * table, 'ä' is mapped to 'A', 'ÿ' is mapped to 'Y', etc. - all
* accented characters except the following are treated the same way. * accented characters except the following are treated the same way.
* , , , , , * Ü, ü, Ö, ö, Ä, ä
*/ */
static const uchar sort_order_latin1_de[] = { static const uchar sort_order_latin1_de[] = {
...@@ -582,7 +582,7 @@ static const uchar combo2map[]={ ...@@ -582,7 +582,7 @@ static const uchar combo2map[]={
my_strnxfrm_latin_de() on both strings and compared the result strings. my_strnxfrm_latin_de() on both strings and compared the result strings.
This means that: This means that:
must also matches E and A, because my_strxn_frm_latin_de() will convert Ä must also matches ÁE and Aè, because my_strxn_frm_latin_de() will convert
both to AE. both to AE.
The other option would be to not do any accent removal in The other option would be to not do any accent removal in
...@@ -708,7 +708,7 @@ void my_hash_sort_latin1_de(CHARSET_INFO *cs __attribute__((unused)), ...@@ -708,7 +708,7 @@ void my_hash_sort_latin1_de(CHARSET_INFO *cs __attribute__((unused)),
/* /*
Remove end space. We have to do this to be able to compare Remove end space. We have to do this to be able to compare
'AE' and '' as identical 'AE' and 'Ä' as identical
*/ */
end= skip_trailing_space(key, len); end= skip_trailing_space(key, len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment