diff --git a/docs/xml/lazutils/codepagescommon.xml b/docs/xml/lazutils/codepagescommon.xml
index 7ff17b4086..1a4d58fdad 100644
--- a/docs/xml/lazutils/codepagescommon.xml
+++ b/docs/xml/lazutils/codepagescommon.xml
@@ -11,7 +11,9 @@
+
- Encoded is a Boolean output parameter which indicates if a routine was found to perform the requested conversion. Its value is False when a conversion routine was not found for the target encoding in ToEncoding.
+ Encoded is a Boolean output parameter which indicates if a routine was found to perform the requested conversion. Its value is False when a conversion routine was not found for the target encoding in ToEncoding.
- SetTargetCodePage is a Boolean argument which indicates if SetCodePage is called to apply a translated code page for the converted value. The default value for the argument is False, and omits the code page for the return value.
+ SetTargetCodePage is a Boolean argument which indicates if SetCodePage is called to apply a translated code page for the converted value. The default value for the argument is False, and omits the code page for the return value.
ConvertEncodingFromUTF8 is used in the implementation of the ConvertEncoding function.
@@ -287,12 +298,12 @@
- Encoded is a Boolean output parameter which indicates if a routine was found to perform the requested conversion. Its value is False when a conversion routine was not found for the source encoding in FromEncoding. + Encoded is a Boolean output parameter which indicates if a routine was found to perform the requested conversion. Its value is False when a conversion routine was not found for the source encoding in FromEncoding.
ConvertEncodingToUTF8 is used in the implementation of the ConvertEncoding function.
@@ -353,7 +372,7 @@
- SetTargetCodePage indicates whether the string with the converted encoding should set the code page for the result. The default value for the argument is False. The SetTargetCodePage argument is ignored when ToEncoding is the UTF-8 encoding ('utf8'). The code page is always set to CP_UTF8 (65001) when UTF-8 encoding is used in the result. + SetTargetCodePage indicates whether the string with the converted encoding should set the code page for the result. The default value for the argument is False. The SetTargetCodePage argument is ignored when ToEncoding is the UTF-8 encoding ('utf8'). The code page is always set to CP_UTF8 (65001) when UTF-8 encoding is used in the result.
For platforms where libiconv is enabled, the iconvert routine is used as a fallback when an encoding conversion routine was not found.
@@ -402,11 +421,15 @@
GetDefaultTextEncoding gets the default encoding name used for text from the DefaultTextEncoding variable (in the unit implementation), when assigned. Otherwise, platform-specific routines are used to get return value like: GetWindowsEncoding, GetUnixEncoding. The value in the EncodingUTF8 constant is used for the Darwin platforms. The return value contains the encoding used for AnsiString in the FPC RTL, and is retained in the DefaultTextEncoding variable for subsequent calls to the routine.
@@ -444,7 +467,9 @@
Converts a value like 'UTF-8' to 'utf8', or 'ISO-8859-1' to 'iso88591'.
@@ -517,7 +542,9 @@
- The arguments to the routine include the UTF-8-encoded string converted in the function, and a boolean argument which indicates if the code page should be set for the string in the return value. Set the SetTargetCodePage parameter to True to set the code page for the ANSI string in the return value. The default value for the argument is False. + The arguments to the routine include the UTF-8-encoded string converted in the function, and a boolean argument which indicates if the code page should be set for the string in the return value. Set the SetTargetCodePage parameter to True to set the code page for the ANSI string in the return value. The default value for the argument is False.
By default, a routine is NOT assigned to ConvertUTF8ToAnsi.
@@ -623,6 +650,22 @@
+ Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayISO_8859_14ToUTF8.
+
- For platforms where system code pages are enabled, SetCodePage is called to convert the value to the ISO 8859-1 code page (28591). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value. + For platforms where system code pages are enabled, SetCodePage is called to convert the value to the ISO 8859-1 code page (28591). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value.
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToISO_8859_1 to perform character conversions needed for the target encoding.
@@ -1100,7 +1146,41 @@
+ UTF8ToISO_8859_14 is a RawByteString function used to convert a UTF-8-encoded string to the ISO 8859-14 (Latin-8 / Celtic) encoding.
+
+ For platforms where system code pages are enabled, SetCodePage is called to convert the value to the ISO 8859-14 code page (28604). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value.
+
+ For other platforms, the UTF8ToSingleByte routine is called using UnicodeToISO_8859_14 to perform character conversions needed for the target encoding.
+
+ UTF8ToISO_8859_14 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
+
- For platforms where system code pages are enabled, SetCodePage is called to convert the value to the ISO 8859-15 code page (28605). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value. + For platforms where system code pages are enabled, SetCodePage is called to convert the value to the ISO 8859-15 code page (28605). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value.
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToISO_8859_15 to perform character conversions needed for the target encoding.
@@ -1134,7 +1214,7 @@
- For platforms where system code pages are enabled, SetCodePage is called to convert the value to the ISO 8859-2 code page (28592). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value. + For platforms where system code pages are enabled, SetCodePage is called to convert the value to the ISO 8859-2 code page (28592). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value.
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToISO_8859_2 to perform character conversions needed for the target encoding.
@@ -1168,7 +1248,7 @@
- For platforms where system code pages are enabled, SetCodePage is called to convert the value to the ISO 8859-9 code page (28599). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value. + For platforms where system code pages are enabled, SetCodePage is called to convert the value to the ISO 8859-9 code page (28599). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value.
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToISO_8859_9 to perform character conversions needed for the target encoding.
@@ -1202,7 +1282,7 @@
- UTF8ToCP1250 calls the UTF8ToSingleByte routine using UnicodeToCP1250 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#129) to the target code page. The character translation table in UnicodeToCP1250 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1250 in the return value. + UTF8ToCP1250 calls the UTF8ToSingleByte routine using UnicodeToCP1250 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#129) to the target code page. The character translation table in UnicodeToCP1250 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1250 in the return value.
UTF8ToCP1250 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
@@ -1233,7 +1313,7 @@
- UTF8ToCP1251 calls the UTF8ToSingleByte routine using UnicodeToCP1251 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#152) to the target code page. The character translation table in UnicodeToCP1251 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1251 in the return value. + UTF8ToCP1251 calls the UTF8ToSingleByte routine using UnicodeToCP1251 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#152) to the target code page. The character translation table in UnicodeToCP1251 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1251 in the return value.
UTF8ToCP1251 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
@@ -1264,7 +1344,7 @@
- UTF8ToCP1252 calls the UTF8ToSingleByte routine using UnicodeToCP1252 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#128) to the target code page. The character translation table in UnicodeToCP1252 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1252 in the return value. + UTF8ToCP1252 calls the UTF8ToSingleByte routine using UnicodeToCP1252 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#128) to the target code page. The character translation table in UnicodeToCP1252 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1252 in the return value.
UTF8ToCP1252 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
@@ -1295,7 +1375,7 @@
- UTF8ToCP1253 calls the UTF8ToSingleByte routine using UnicodeToCP1253 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#129) to the target code page. The character translation table in UnicodeToCP1253 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1253 in the return value. + UTF8ToCP1253 calls the UTF8ToSingleByte routine using UnicodeToCP1253 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#129) to the target code page. The character translation table in UnicodeToCP1253 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1253 in the return value.
UTF8ToCP1253 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
@@ -1326,7 +1406,7 @@
- UTF8ToCP1254 calls the UTF8ToSingleByte routine using UnicodeToCP1254 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#129) to the target code page. The character translation table in UnicodeToCP1254 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1254 in the return value. + UTF8ToCP1254 calls the UTF8ToSingleByte routine using UnicodeToCP1254 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#129) to the target code page. The character translation table in UnicodeToCP1254 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1254 in the return value.
UTF8ToCP1254 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
@@ -1357,7 +1437,7 @@
- UTF8ToCP1255 calls the UTF8ToSingleByte routine using UnicodeToCP1255 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#129) to the target code page. The character translation table in UnicodeToCP1255 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1255 in the return value. + UTF8ToCP1255 calls the UTF8ToSingleByte routine using UnicodeToCP1255 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#129) to the target code page. The character translation table in UnicodeToCP1255 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1255 in the return value.
UTF8ToCP1255 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
@@ -1388,7 +1468,7 @@
- For platforms where system code pages are enabled, SetCodePage is called to convert the value to the Arabic code page (1256). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value. + For platforms where system code pages are enabled, SetCodePage is called to convert the value to the Arabic code page (1256). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value.
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToCP1256 to perform character conversions needed for the target encoding.
@@ -1422,7 +1502,7 @@
- UTF8ToCP1257 calls the UTF8ToSingleByte routine using UnicodeToCP1257 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#129) to the target code page. The character translation table in UnicodeToCP1257 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1257 in the return value. + UTF8ToCP1257 calls the UTF8ToSingleByte routine using UnicodeToCP1257 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#129) to the target code page. The character translation table in UnicodeToCP1257 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1257 in the return value.
UTF8ToCP1255 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
@@ -1453,7 +1533,7 @@
- UTF8ToCP1258 calls the UTF8ToSingleByte routine using UnicodeToCP1258 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#129) to the target code page. The character translation table in UnicodeToCP1258 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1258 in the return value. + UTF8ToCP1258 calls the UTF8ToSingleByte routine using UnicodeToCP1258 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#129) to the target code page. The character translation table in UnicodeToCP1258 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 1258 in the return value.
UTF8ToCP1258 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
@@ -1484,7 +1564,7 @@
- For platforms where system code pages are enabled, SetCodePage is called to convert the value to the DOS Latin US code page (437). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value. + For platforms where system code pages are enabled, SetCodePage is called to convert the value to the DOS Latin US code page (437). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value.
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToCP437 to perform character conversions needed for the target encoding.
@@ -1518,7 +1598,7 @@
- For platforms where system code pages are enabled, SetCodePage is called to convert the value to the DOS Western Europe code page (850). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value. + For platforms where system code pages are enabled, SetCodePage is called to convert the value to the DOS Western Europe code page (850). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value.
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToCP850 to perform character conversions needed for the target encoding.
@@ -1552,7 +1632,7 @@
- For platforms where system code pages are enabled, SetCodePage is called to convert the value to the DOS Central Europe code page (852). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value. + For platforms where system code pages are enabled, SetCodePage is called to convert the value to the DOS Central Europe code page (852). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value.
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToCP852 to perform character conversions needed for the target encoding.
@@ -1586,7 +1666,7 @@
- For platforms where system code pages are enabled, SetCodePage is called to convert the value to the DOS Cyrillic Russian code page (866). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value. + For platforms where system code pages are enabled, SetCodePage is called to convert the value to the DOS Cyrillic Russian code page (866). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value.
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToCP866 to perform character conversions needed for the target encoding.
@@ -1620,7 +1700,7 @@
- UTF8ToCP874 calls the UTF8ToSingleByte routine using UnicodeToCP874 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#129) to the target code page. The character translation table in UnicodeToCP874 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 874 in the return value. + UTF8ToCP874 calls the UTF8ToSingleByte routine using UnicodeToCP874 to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because of a failure when translating Unicode code points (#129) to the target code page. The character translation table in UnicodeToCP874 is used instead. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 874 in the return value.
UTF8ToCP874 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
@@ -1651,7 +1731,7 @@
- For platforms where system code pages are enabled, SetCodePage is called to convert the value to the KOI8-R code page (20866). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value. + For platforms where system code pages are enabled, SetCodePage is called to convert the value to the KOI8-R code page (20866). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value.
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToKOI8R to perform character conversions needed for the target encoding.
@@ -1681,7 +1761,7 @@
- For platforms where system code pages are enabled, SetCodePage is called to convert the value to the KOI8-U code page (21866). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value. + For platforms where system code pages are enabled, SetCodePage is called to convert the value to the KOI8-U code page (21866). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value.
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToKOI8U to perform character conversions needed for the target encoding.
@@ -1711,7 +1791,7 @@
- UTF8ToKOI8RU calls the UTF8ToSingleByte routine using UnicodeToKOI8RU to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because KOI8RU does not have an official code page. The character translation table in UnicodeToKOI8RU is used to convert character values for the encoding. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 0 in the return value. + UTF8ToKOI8RU calls the UTF8ToSingleByte routine using UnicodeToKOI8RU to perform character conversions needed for the target encoding. System code pages are not used (when enabled) because KOI8RU does not have an official code page. The character translation table in UnicodeToKOI8RU is used to convert character values for the encoding. When SetTargetCodePage is True, SetCodePage is called (without character conversion) to set the code page to 0 in the return value.
UTF8ToKOI8RU is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
@@ -1738,7 +1818,7 @@
- For platforms where system code pages are enabled, SetCodePage is called to convert the value to the Macintosh Roman code page (10000). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value. + For platforms where system code pages are enabled, SetCodePage is called to convert the value to the Macintosh Roman code page (10000). If SetTargetCodePage is False, SetCodePage is called again to apply the CP_ACP (ANSI) code page in the return value.
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToMacintosh to perform character conversions needed for the target encoding.
@@ -1768,7 +1848,7 @@
- No actions are performed in the routine when s contains an empty string (''), and the return value is set to an empty string as well. + No actions are performed in the routine when s contains an empty string (''), and the return value is set to an empty string as well.
UTF8ToUCS2LE does not include a byte order mark (BOM) in the UCS2-encoded output. @@ -1867,7 +1949,7 @@ UTF8ToUCS2BE converts the string value in s from its multi-byte variable length UTF-8 encoding to the fixed length 16-bit character set used in the UCS2 BE (Big Endian) encoding. UTF8ToUCS2BE iterates over each of the UTF-8 codepoints in s, and calls NtoBE to convert the Unicode character value to the Most Significant byte order used in the encoding. Unicode characters with a value $FFFF or greater are ignored in the conversion.
- No actions are performed in the routine when s contains an empty string (''), and the return value is set to an empty string as well. + No actions are performed in the routine when s contains an empty string (''), and the return value is set to an empty string as well.
UTF8ToUCS2BE does not include a byte order mark (BOM) in the UCS2-encoded output.
@@ -1965,7 +2047,7 @@
- GetSupportedEncodings is a procedure used to get the names for the supported encodings on the platform or operating system. GetSupportedEncodings adds each of the encoding names to List; it does NOT removing any existing content in the string list.
+ GetSupportedEncodings is a procedure used to get the names for the supported encodings on the platform or operating system. GetSupportedEncodings adds each of the encoding names to List; it does NOT remove any existing content in the string list.
GetSupportedEncodings stores the following values in the List argument:
@@ -2100,6 +2188,8 @@
+ GetSupportedEncodings is used to implement the encodings menu for the source editor in the Lazarus IDE, and to implement the TIpHtmlParser class from the Turbo Power IPro package.
+
+