1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065
|
<?xml version="1.0" encoding="UTF-8"?>
<fpdoc-descriptions>
<package name="lazutils">
<!--
====================================================================
LConvEncoding
====================================================================
-->
<module name="LConvEncoding">
<short>
Contains routines used to perform conversions between Unicode and System Code Page encodings.
</short>
<descr>
<p>
<file>lconvencoding.pas</file> provides types, variable, constants, and routines used to perform conversions to and from Unicode and /or System Code Page encodings. Functions in this unit are thread-safe.
</p>
<p>
For environments where the RTL uses UTF-8 encoding, the UseSystemCPConv compiler define is enabled to include System Code Page conversions.
</p>
<p>
<file>lconvencoding.pas</file> is part of the <file>LazUtils</file> package.
</p>
</descr>
<!-- unresolved external references -->
<element name="SysUtils"/>
<element name="Classes"/>
<element name="Dos"/>
<element name="LazUTF8"/>
<element name="CodepagesCommon"/>
<element name="CodepagesAsian"/>
<element name="iconvenc"/>
<element name="TConvertEncodingErrorMode">
<short>Represents the behaviors for an error occurring in an encoding conversion.</short>
<descr>
<p>
<var>TConvertEncodingErrorMode</var> is an enumerated type with values that represent the behavior applied when an encoding conversion error is detected. TConvertEncodingErrorMode is the type used for the <var>ConvertEncodingErrorMode</var> variable.
</p>
</descr>
<version>
Introduced in version 2.2.
</version>
<seealso>
<link id="ConvertEncodingErrorMode"/>
</seealso>
</element>
<element name="TConvertEncodingErrorMode.ceemSkip">
<short>Skip or ignore the encoding conversion error.</short>
</element>
<element name="TConvertEncodingErrorMode.ceemException">
<short>
Raises an EConvertError exception with a message relevant to the conversion error.
</short>
</element>
<element name="TConvertEncodingErrorMode.ceemReplace">
<short>Replace the suspect value with an error placeholder (usually the '?' character).</short>
</element>
<element name="TConvertEncodingErrorMode.ceemReturnEmpty">
<short>Return an empty string ('') for the suspect value.</short>
</element>
<element name="ConvertEncodingErrorMode">
<short>Error handling behavior for encoding conversion errors.</short>
<descr>
<p>
<var>ConvertEncodingErrorMode</var> is a unit global <var>TConvertEncodingErrorMode</var> variable which controls the behavior when an error is detected in an encoding conversion routine. For example:
</p>
<ul>
<li>UTF-8 to single byte encoding</li>
<li>DBCS (Asian code pages) encoding to UTF-8</li>
<li>UTF-8 to DBCS (Double Byte Character Sets)</li>
</ul>
<p>
The default value for the variable is <var>ceemSkip</var>, and indicates that an error is skipped or ignored when encountered in an encoding conversion.
</p>
</descr>
<version>
Introduced in version 2.2. Replaces use of the ConvertEncodingErrorRaisesException variable.
</version>
<seealso>
<link id="TConvertEncodingErrorMode"/>
<link id="UTF8ToSingleByte"/>
</seealso>
</element>
<element name="EncodingUTF8">
<short>Encoding name for UTF-8.</short>
</element>
<element name="EncodingAnsi">
<short>Encoding name for ANSI.</short>
</element>
<element name="EncodingUTF8BOM">
<short>Encoding name for UTF-8 with a byte order mark.</short>
</element>
<element name="EncodingUCS2LE">
<short>Encoding name for UCS 2-byte Little Endian.</short>
</element>
<element name="EncodingUCS2BE">
<short>Encoding name for UCS 2-byte Big Endian.</short>
</element>
<element name="EncodingCP1250">
<short>Encoding name for Code Page 1250.</short>
</element>
<element name="EncodingCP1251">
<short>Encoding name for Code Page 1251.</short>
</element>
<element name="EncodingCP1252">
<short>Encoding name for Code Page 1252.</short>
</element>
<element name="EncodingCP1253">
<short>Encoding name for Code Page 1253.</short>
</element>
<element name="EncodingCP1254">
<short>Encoding name for Code Page 1254.</short>
</element>
<element name="EncodingCP1255">
<short>Encoding name for Code Page 1255.</short>
</element>
<element name="EncodingCP1256">
<short>Encoding name for Code Page 1256.</short>
</element>
<element name="EncodingCP1257">
<short>Encoding name for Code Page 1257.</short>
</element>
<element name="EncodingCP1258">
<short>Encoding name for Code Page 1258.</short>
</element>
<element name="EncodingCP437">
<short>Encoding name for Code Page 437.</short>
</element>
<element name="EncodingCP850">
<short>Encoding name for Code Page 850.</short>
</element>
<element name="EncodingCP852">
<short>Encoding name for Code Page 852.</short>
</element>
<element name="EncodingCP866">
<short>Encoding name for Code Page 866.</short>
</element>
<element name="EncodingCP874">
<short>Encoding name for Code Page 874.</short>
</element>
<element name="EncodingCP932">
<short>Encoding name for Code Page 932.</short>
</element>
<element name="EncodingCP936">
<short>Encoding name for Code Page 936.</short>
</element>
<element name="EncodingCP949">
<short>Encoding name for Code Page 949.</short>
</element>
<element name="EncodingCP950">
<short>Encoding name for Code Page 950.</short>
</element>
<element name="EncodingCPMac">
<short>Encoding name for the Macintosh Code Page.</short>
</element>
<element name="EncodingCPKOI8R">
<short>Encoding name for KOI8-R Code Page.</short>
</element>
<element name="EncodingCPKOI8U">
<short>Encoding name for KOI8-U Code Page.</short>
</element>
<element name="EncodingCPKOI8RU">
<short>Encoding name for KOI8-RU Code Page.</short>
</element>
<element name="EncodingCPIso1">
<short>Encoding name for ISO 8859-1 Code Page.</short>
</element>
<element name="EncodingCPIso2">
<short>Encoding name for ISO 8859-2 Code Page.</short>
</element>
<element name="EncodingCPIso15">
<short>Encoding name for ISO 8859-15 Code Page.</short>
</element>
<element name="UTF8BOM">
<short>ANSI representation for the UTF-8 Byte Order Mark.</short>
<descr/>
<seealso/>
</element>
<element name="UTF16BEBOM">
<short>ANSI representation for the UTF-16 Big Endian Byte Order Mark.</short>
<descr/>
<seealso/>
</element>
<element name="UTF16LEBOM">
<short>ANSI representation for the UTF-16 Little Endian Byte Order Mark.</short>
<descr/>
<seealso/>
</element>
<element name="UTF32BEBOM">
<short>ANSI representation for the UTF-32 Big Endian Byte Order Mark.</short>
<descr/>
<seealso/>
</element>
<element name="UTF32LEBOM">
<short>ANSI representation for the UTF-32 Little Endian Byte Order Mark.</short>
<descr/>
<seealso/>
</element>
<element name="GuessEncoding">
<short>Tries to determine the encoding used for the specified value.</short>
<descr>
<p>
<var>GuessEncoding</var> is a <var>String</var> function which tries to determine the encoding used for the value specified in <var>S</var>. The return value contains an encoding name, like 'utf8' or 'ISO-8859-1'. It may contain an empty string ('') when S is also an empty string.
</p>
<p>
GuessEncoding checks S for various Byte Order Marks at the start of the value, including: <var>UTF8BOM</var>, <var>UTF16LEBOM</var>, and <var>UTF16BEBOM</var>. When present, the BOM determines the encoding used for the value.
</p>
<p>
Next, it checks for an explict '<b>{%encoding </b>' marker at the start of the value. When present, the value after the marker (up to the closing '<b>}</b>' character) is normalized and used as the return value.
</p>
<p>
Finally, it checks for a valid UTF-8 encoding (which includes ASII characters).
All characters in S are examined until a character whose UTF-8 code point is not valid is encountered.
</p>
<p>
When <var>EncodingValid</var> is <b>True</b>, <var>EncodingAnsi</var> is assumed. Otherwise, the default encoding for the platform is used. When the return value is <var>EncodingUTF8</var>, it is changed to '<b>ISO-8859-1</b>'. This is done because the system may use the UTF-8 encoding, but the value in S does not. ISO 8859-1 has a full mapping to Unicode, and this prevents data loss in encoding conversions.
</p>
</descr>
<seealso/>
</element>
<element name="GuessEncoding.Result">
<short>Encoding name detected, or a default value.</short>
</element>
<element name="GuessEncoding.s">
<short>String with the content examined in the routine.</short>
</element>
<element name="ConvertEncodingFromUTF8">
<short>Converts the encoded value from UTF-8 to the encoding with the specified name.</short>
<descr>
<p>
The s argument contains the UTF-8-encoded value converted in the routine.
</p>
<p>
ToEncoding is a String value with the name for the target encoding. It is normalized in the routine to remove hyphen characters in the encoding name. The value corresponds to the encoding name constants defined in the unit, and is used to determine which routine is called to perform the encoding conversion.
</p>
<p>
For example, the following is a sample of the encoding names and their corresponding conversion routines:
</p>
<dl>
<dt>EncodingUTF8BOM ('utf8bom')</dt>
<dd>UTF8ToUTF8BOM</dd>
<dt>EncodingCPIso1 ('iso88591')</dt>
<dd>UTF8ToISO_8859_1</dd>
<dt>EncodingCP1250 ('cp1250')</dt>
<dd>UTF8ToCP1250</dd>
<dt>EncodingCP1252 ('cp1252')</dt>
<dd>UTF8ToCP1252</dd>
<dt>EncodingCP850 ('cp850')</dt>
<dd>UTF8ToCP850</dd>
<dt>EncodingCPKOI8R ('koi8r')</dt>
<dd>UTF8ToKOI8R</dd>
<dt>EncodingAnsi ('ansi')</dt>
<dd>ConvertUTF8ToAnsi</dd>
</dl>
<p>
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.
</p>
<p>
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.
</p>
<p>
ConvertEncodingFromUTF8 is used in the implementation of the ConvertEncoding function.
</p>
</descr>
<seealso>
<link id="ConvertEncoding"/>
<link id="NormalizeEncoding"/>
<link id="ConvertEncodingToUTF8"/>
</seealso>
</element>
<element name="ConvertEncodingFromUTF8.Result">
<short>String value after conversion to the specified encoding.</short>
</element>
<element name="ConvertEncodingFromUTF8.s">
<short>UTF-8-encoded value converted in the routine.</short>
</element>
<element name="ConvertEncodingFromUTF8.ToEncoding">
<short>Encoding name for the converted value.</short>
</element>
<element name="ConvertEncodingFromUTF8.Encoded">
<short>
True if the return value contains multi-byte encoded values, False if it contains a single-byte ANSI string.
</short>
</element>
<element name="ConvertEncodingFromUTF8.SetTargetCodePage">
<short>
True if the code page should be set for the return value, False if a code page is not used.
</short>
</element>
<element name="ConvertEncodingToUTF8">
<short>Converts the specified string value to the UTF-8 encoding.</short>
<descr>
<p>
ConvertEncodingToUTF8 converts the encoding for a string value from the specified encoding to UTF-8. The s argument contains the string value converted in the routine.
</p>
<p>
FromEncoding is a String value with the name for the existing encoding is s. It is normalized in the routine to remove hyphen characters in the encoding name. The value corresponds to the encoding name constants defined in the unit, and is used to determine which routine is called to perform the encoding conversion.
</p>
<p>
For example, the following is a sample of the encoding names and their corresponding conversion routines:
</p>
<dl>
<dt>EncodingUTF8BOM ('utf8bom')</dt>
<dd>UTF8BOMToUTF8</dd>
<dt>EncodingCPIso1 ('iso88591')</dt>
<dd>ISO_8859_1ToUTF8</dd>
<dt>EncodingCP1250 ('cp1250')</dt>
<dd>CP1250ToUTF8</dd>
<dt>EncodingCP1252 ('cp1252')</dt>
<dd>CP1252ToUTF8</dd>
<dt>EncodingCP850 ('cp850')</dt>
<dd>CP850ToUTF8</dd>
<dt>EncodingCPKOI8R ('koi8r')</dt>
<dd>KOI8RToUTF8</dd>
<dt>EncodingAnsi ('ansi') or the default text encoding for the platform</dt>
<dd>ConvertAnsiToUTF8</dd>
</dl>
<p>
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.
</p>
<p>
ConvertEncodingToUTF8 is used in the implementation of the ConvertEncoding function.
</p>
<remark>
Conversions to the UTF-8 encoding will always set the code page for the converted value to CP_UTF8 (65001). In other words, the SetTargetCodePage argument to the ConvertEncoding() function is ignored for conversions to UTF-8.
</remark>
</descr>
<seealso>
<link id="ConvertEncoding"/>
<link id="ConvertEncodingFromUTF8"/>
<link id="ConvertAnsiToUTF8"/>
<link id="NormalizeEncoding"/>
<link id="GetDefaultTextEncoding"/>
</seealso>
</element>
<element name="ConvertEncodingToUTF8.Result">
<short>Value for the specified string after encoding conversion.</short>
</element>
<element name="ConvertEncodingToUTF8.s">
<short>String with the encoded value converted to UTF-8.</short>
</element>
<element name="ConvertEncodingToUTF8.FromEncoding">
<short>Encoding name for the value in s.</short>
</element>
<element name="ConvertEncodingToUTF8.Encoded">
<short>True if the result contains a multi-byte encoded value. Always True for conversions to UTF-8.</short>
</element>
<element name="ConvertEncoding">
<short>
Converts the specified value from its source encoding to a target encoding using an optional code page.
</short>
<descr>
<p>
ConvertEncoding is a String function used to convert the string specified in s from its original encoding name (FromEncoding) to a target encoding (ToEncoding).
</p>
<p>
When FromEncoding is omitted, or specified as an empty string (''), UTF-8 is used as the original encoding. If the original encoding is ANSI, the default text encoding for the platform (GetDefaultTextEncoding) is used as the original encoding.
</p>
<p>
Conversely, when ToEncoding is omitted or an empty string, UTF-8 is used as the target encoding. If the target encoding is ANSI, the default text encoding for the platform (GetDefaultTextEncoding) is used as the target encoding.
</p>
<p>
No actions are performed in the routine when FromEncoding and ToEncoding have the same values.
</p>
<p>
ConvertEncoding calls ConvertEncodingFromUTF8 to convert the string value when the FromEncoding is UTF-8. ConvertEncodingToUTF8 is called when ToEncoding is UTF-8. For other encoding conversions, ConvertEncodingToUTF8 is called to both get a UTF-8 value which is then converted using ConvertEncodingFromUTF8.
</p>
<p>
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.
</p>
<p>
For platforms where libiconv is enabled, the iconvert routine is used as a fallback when an encoding conversion routine was not found.
</p>
<p>
The return value is the original string in s if a transcoding operation is not successfully performed (or not needed) for the original string value using the specified encodings.
</p>
</descr>
<seealso/>
</element>
<element name="ConvertEncoding.Result">
<short>Value for the specified string after encoding conversion.</short>
</element>
<element name="ConvertEncoding.s">
<short>String value converted in the routine.</short>
</element>
<element name="ConvertEncoding.FromEncoding">
<short>Encoding name for the original string value.</short>
</element>
<element name="ConvertEncoding.ToEncoding">
<short>Encoding name for the converted value.</short>
</element>
<element name="ConvertEncoding.SetTargetCodePage">
<short>True if the code page should be set for the converted value. Default is False.</short>
</element>
<element name="GetDefaultTextEncoding">
<short>Gets the name for the default text encoding used on the platform or operating system.</short>
<descr>
<p>
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.
</p>
</descr>
<seealso>
<link id="EncodingUTF8"/>
<link id="NormalizeEncoding"/>
</seealso>
</element>
<element name="GetDefaultTextEncoding.Result">
<short>The name for the default text encoding used on the platform.</short>
</element>
<element name="GetConsoleTextEncoding">
<short>Gets the encoding used for a console application on the platform.</short>
<descr>
<p>
GetConsoleTextEncoding is String function which gets the encoding name used for console applications.
</p>
<p>
The return value may differ from the normal system encoding on some Windows versions, where the OEM code page is used for a console application. For more details, see: <url href="https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/20552">https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/20552</url>.
</p>
<p>
For all other platforms, the value from GetDefaultTextEncoding is used in the return value. The return value is normalized (hyphen characters removed and converted to lowercase).
</p>
</descr>
<seealso>
<link id="GetDefaultTextEncoding"/>
<link id="NormalizeEncoding"/>
</seealso>
</element>
<element name="GetConsoleTextEncoding.Result">
<short>Name of the encoding used for text in a console application.</short>
</element>
<element name="NormalizeEncoding">
<short>Converts the specified encoding name to lowercase and removes '-' characters.</short>
<descr>
<p>
Converts a value like 'UTF-8' to 'utf8', or 'ISO-8859-1' to 'iso88591'.
</p>
<p>
NormalizeEncoding is used in the implementation of conversion routines, like:
</p>
<ul>
<li>GetDefaultTextEncoding</li>
<li>GetConsoleTextEncoding</li>
<li>GuessEncoding</li>
<li>ConvertEncodingFromUTF8</li>
<li>ConvertEncodingToUTF8</li>
<li>ConvertEncoding</li>
</ul>
</descr>
<seealso>
<link id="GetDefaultTextEncoding"/>
<link id="GetConsoleTextEncoding"/>
<link id="GuessEncoding"/>
<link id="ConvertEncodingFromUTF8"/>
<link id="ConvertEncodingToUTF8"/>
<link id="ConvertEncoding"/>
</seealso>
</element>
<element name="NormalizeEncoding.Result">
<short>Contains the encoding name converted to lowercase with hyphen ('-') characters removed.</short>
</element>
<element name="NormalizeEncoding.Encoding">
<short>Encoding name normalized in the routine.</short>
</element>
<element name="TConvertEncodingFunction">
<short>Specifies a function used to convert a single-byte string value to a specific multi-byte encoding.</short>
<descr>
<p>
<var>TConvertEncodingFunction</var> is the type used for the <var>ConvertAnsiToUTF8</var> variable.
</p>
</descr>
<seealso>
<link id="ConvertAnsiToUTF8"/>
<link id="ConvertUTF8ToAnsi"/>
<link id="TConvertUTF8ToEncodingFunc"/>
</seealso>
</element>
<element name="TConvertEncodingFunction.Result">
<short>Value after converting the value to the required encoding.</short>
</element>
<element name="TConvertEncodingFunction.s">
<short>Single-byte string value examined and converted in the routine.</short>
</element>
<element name="TConvertUTF8ToEncodingFunc">
<short>
Specifies a function used to convert a string value from UTF-8 encoding to another encoding with an optional code page.
</short>
<descr>
<p>
TConvertUTF8ToEncodingFunc is the type used for the ConvertUTF8ToAnsi variable in <file>lconvencoding.pas</file>.
</p>
</descr>
<seealso>
<link id="ConvertUTF8ToAnsi"/>
</seealso>
</element>
<element name="TConvertUTF8ToEncodingFunc.Result">
<short>Value for the string using the code page / encoding implemented in the routine.</short>
</element>
<element name="TConvertUTF8ToEncodingFunc.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="TConvertUTF8ToEncodingFunc.SetTargetCodePage">
<short>True to set the target code page, False if the code page is not needed.</short>
</element>
<element name="TCharToUTF8Table">
<short>Alias for the TCharToUTF8Table type in <file>CodepagesCommon.pas</file>.</short>
<descr/>
<seealso/>
</element>
<element name="TUnicodeToCharID">
<short>
Specifies an Integer function type used to get a character identifier for a specific Unicode character.
</short>
<descr>
<p>
TUnicodeToCharID is the type passed as an argument to conversion routines like UTF8ToSingleByte and UTF8ToDBCS.
</p>
</descr>
<seealso>
<link id="UTF8ToDBCS"/>
<link id="UTF8ToSingleByte"/>
</seealso>
</element>
<element name="TUnicodeToCharID.Result">
<short>Integer value for the specified Unicode character.</short>
</element>
<element name="TUnicodeToCharID.Unicode">
<short>Cardinal value for the Unicode character converted in the routine.</short>
</element>
<element name="ConvertAnsiToUTF8">
<short>Contains the routine used to convert an ANSI string value to UTF-8 encoding.</short>
<descr>
<p>
<var>ConvertAnsiToUTF8</var> is a <var>TConvertEncodingFunction</var> variable with the routine used to convert a String from its ANSI-encoded value to the UTF-8 encoding. A routine which implements the TConvertEncodingFunction interface can be assigned to ConvertAnsiToUTF8 to handle conversions from the default text encoding, which may use an OEM code page, to the UTF-8 encoding.
</p>
<p>
By default, a routine is <b>NOT</b> assigned to ConvertAnsiToUTF8.
</p>
<p>
ConvertAnsiToUTF8 is called (when assigned) from the ConvertEncodingToUTF8 routine.
</p>
</descr>
<seealso>
<link id="TConvertEncodingFunction"/>
<link id="ConvertEncodingToUTF8"/>
</seealso>
</element>
<element name="ConvertUTF8ToAnsi">
<short>Contains the routine used to convert from UTF-8 encoding to ANSI encoding.</short>
<descr>
<p>
ConvertUTF8ToAnsi is a TConvertUTF8ToEncodingFunc variable with the routine used to convert a string value from UTF-8 encoding to ANSI encoding. A routine which implements the TConvertUTF8ToEncodingFunc interface can be assigned to ConvertUTF8ToAnsi to the conversion.
</p>
<p>
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.
</p>
<p>
By default, a routine is <b>NOT</b> assigned to ConvertUTF8ToAnsi.
</p>
<p>
ConvertUTF8ToAnsi is called (when assigned) from the ConvertEncodingFromUTF8 routine.
</p>
</descr>
<seealso>
<link id="TConvertUTF8ToEncodingFunc"/>
<link id="ConvertEncodingFromUTF8"/>
</seealso>
</element>
<element name="UTF8BOMToUTF8">
<short>Removes the UTF-8 BOM from the UTF-8 encoded value.</short>
<descr>
<p>
The return value is the value in <var>s</var> after removing the Byte Order Mark in <var>UTF8BOM</var> from the start of the string. The return value is the same as the value in s when UTF8BOM is not found in the string.
</p>
<p>
No actions are performed in the routine when <var>s</var> is an empty string (<b>''</b>). The return value is also an empty string.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8BOMToUTF8.Result">
<short>Value after removing the UTF-8 BOM.</short>
</element>
<element name="UTF8BOMToUTF8.s">
<short>UTF-8-encoded value examined in the routine.</short>
</element>
<element name="ISO_8859_1ToUTF8">
<short>Converts an ISO 8859-1-encoded string to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayISO_8859_1ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="ISO_8859_1ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="ISO_8859_1ToUTF8.s">
<short>String with the value in ISO 8859-1 encoding.</short>
</element>
<element name="ISO_8859_15ToUTF8">
<short>Converts an ISO 8859-15-encoded string to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayISO_8859_15ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="ISO_8859_15ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="ISO_8859_15ToUTF8.s">
<short>String with the value in ISO 8859-15 encoding.</short>
</element>
<element name="ISO_8859_2ToUTF8">
<short>Converts an ISO 8859-2-encoded string to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayISO_8859_2ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="ISO_8859_2ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="ISO_8859_2ToUTF8.s">
<short>String with the value in ISO 8859-2 encoding.</short>
</element>
<element name="CP1250ToUTF8">
<short>Converts a Code Page 1250-encoded string to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayCP1250ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="CP1250ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="CP1250ToUTF8.s">
<short>String with the value in Code Page 1250 encoding.</short>
</element>
<element name="CP1251ToUTF8">
<short>Converts a Code Page 1251-encoded value to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayCP1251ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="CP1251ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="CP1251ToUTF8.s">
<short>String with the value in Code Page 1251 encoding.</short>
</element>
<element name="CP1252ToUTF8">
<short>Converts a Code Page 1252-encoded value to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayCP1252ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="CP1252ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="CP1252ToUTF8.s">
<short>String with the value in Code Page 1252 encoding.</short>
</element>
<element name="CP1253ToUTF8">
<short>Converts a Code Page 1253-encoded value to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayCP1253ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="CP1253ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="CP1253ToUTF8.s">
<short>String with the value in Code Page 1253 encoding.</short>
</element>
<element name="CP1254ToUTF8">
<short>Converts a Code Page 1254-encoded value to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayCP1254ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="CP1254ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="CP1254ToUTF8.s">
<short>String with the value in Code Page 1254 encoding.</short>
</element>
<element name="CP1255ToUTF8">
<short>Converts a Code Page 1255-encoded value to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayCP1255ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="CP1255ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="CP1255ToUTF8.s">
<short>String with the value in Code Page 1255 encoding.</short>
</element>
<element name="CP1256ToUTF8">
<short>Converts a Code Page 1256-encoded value to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayCP1256ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="CP1256ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="CP1256ToUTF8.s">
<short>String with the value in Code Page 1256 encoding.</short>
</element>
<element name="CP1257ToUTF8">
<short>Converts a Code Page 1257-encoded value to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayCP1257ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="CP1257ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="CP1257ToUTF8.s">
<short>String with the value in Code Page 1257 encoding.</short>
</element>
<element name="CP1258ToUTF8">
<short>Converts a Code Page 1258-encoded value to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayCP1258ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="CP1258ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="CP1258ToUTF8.s">
<short>String with the value in Code Page 1258 encoding.</short>
</element>
<element name="CP437ToUTF8">
<short>Converts a Code Page 437-encoded value to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayCP437ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="CP437ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="CP437ToUTF8.s">
<short>String with the value in Code Page 437 encoding.</short>
</element>
<element name="CP850ToUTF8">
<short>Converts a Code Page 850-encoded value to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayCP850ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="CP850ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="CP850ToUTF8.s">
<short>String with the value in Code Page 850 encoding.</short>
</element>
<element name="CP852ToUTF8">
<short>Converts a Code Page 852-encoded value to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayCP852ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="CP852ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="CP852ToUTF8.s">
<short>String with the value in Code Page 852 encoding.</short>
</element>
<element name="CP866ToUTF8">
<short>Converts a Code Page 866-encoded value to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayCP866ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="CP866ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="CP866ToUTF8.s">
<short>String with the value in Code Page 866 encoding.</short>
</element>
<element name="CP874ToUTF8">
<short>Converts a Code Page 874-encoded value to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayCP874ToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="CP874ToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="CP874ToUTF8.s">
<short>String with the value in Code Page 874 encoding.</short>
</element>
<element name="KOI8RToUTF8">
<short>Converts a KOI8-R-encoded value to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayKOI8RToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="KOI8RToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="KOI8RToUTF8.s">
<short>String with the value in the KOI8R encoding.</short>
</element>
<element name="KOI8ToUTF8">
<short>
Deprecated in Lazarus 2.2.0. Use KOI8RToUTF8 instead.
</short>
<descr>
<p>
Deprecated in Lazarus 2.2.0. Use KOI8RToUTF8 instead.
</p>
</descr>
<seealso/>
</element>
<element name="KOI8ToUTF8.Result">
<short/>
</element>
<element name="KOI8ToUTF8.s">
<short/>
</element>
<element name="MacintoshToUTF8">
<short>Converts a value encoded using the the Macintosh Code Page to UTF-8.</short>
<descr>
<p>
Calls SingleByteToUTF8 to convert the specified string using the character translation array in ArrayMacintoshToUTF8.
</p>
</descr>
<seealso/>
</element>
<element name="MacintoshToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="MacintoshToUTF8.s">
<short>String with the value in the Macintosh Roman encoding.</short>
</element>
<element name="SingleByteToUTF8">
<short>Converts a string with single-byte values to UTF-8 using a character translation array.</short>
<descr>
<p>
s is the string, in its single-byte encoding, with the character values converted in the routine.
</p>
<p>
Table is a TCharToUTF8Table type and contains an array with the multi-byte values for each of the character using the UTF-8 encoding. The array has 256 elements representing #0 and each of the decimal values in the single byte character set, and may contain 1-4 byte values as needed for the UTF-8 encoding.
</p>
<p>
SingleByteToUTF8 iterates over the character values in s, and converts each single-byte character to the multi-byte value at the corresponding ordinal position in Table. If s is an empty string (''), the return value is also an empty string.
</p>
<p>
The return value is cast to a RawByteString type, and its code page is set to CP_UTF8 (65001).
</p>
</descr>
<seealso>
<link id="TCharToUTF8Table"/>
<link id="#lazutils.codepagescommon.ArrayISO_8859_1ToUTF8">ArrayISO_8859_1ToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayISO_8859_15ToUTF8">ArrayISO_8859_15ToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayISO_8859_2ToUTF8">ArrayISO_8859_2ToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayCP1250ToUTF8">ArrayCP1250ToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayCP1251ToUTF8">ArrayCP1251ToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayCP1252ToUTF8">ArrayCP1252ToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayCP1253ToUTF8">ArrayCP1253ToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayCP1254ToUTF8">ArrayCP1254ToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayCP1255ToUTF8">ArrayCP1255ToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayCP1255ToUTF8">ArrayCP1255ToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayCP1257ToUTF8">ArrayCP1257ToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayCP437ToUTF8">ArrayCP437ToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayCP850ToUTF8">ArrayCP850ToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayCP866ToUTF8">ArrayCP866ToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayKOI8RToUTF8">ArrayKOI8RToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayKOI8UToUTF8">ArrayKOI8UToUTF8</link>
<link id="#lazutils.codepagescommon.ArrayMacintoshToUTF8">ArrayMacintoshToUTF8</link>
</seealso>
</element>
<element name="SingleByteToUTF8.Result">
<short>String with the UTF-8-encoded value, or an empty string.</short>
</element>
<element name="SingleByteToUTF8.s">
<short>String with the single-byte values converted in the routine.</short>
</element>
<element name="SingleByteToUTF8.Table">
<short>Table with Character to PChar mappings for the converted value.</short>
</element>
<element name="UCS2LEToUTF8">
<short>Converts a string from UCS 2-byte LE encoding to UTF-8.</short>
<descr>
<p>
<var>UCS2LEToUTF8</var> is a <var>String</var> function used to convert a value encoded using UCS2 LE (Little Endian) to its UTF-8 encoding. UCS2 is a fixed-length encoding where each character is represented using 2 bytes (16-bits). Byte values are stored in Least Significant (Little Endian) byte order.
</p>
<p>
UCS2LEToUTF8 iterates over the characters in the string value, and converts each character to the variable length multi-byte encoding used for characters in UTF-8. LEToN is called to convert the byte values to the byte order used for the platform. The UnicodeToUTF8SkipErrors routine in <file>lazutf8.pas</file> is called to handle code points which are malformed, require translation or are not used in UTF-8.
</p>
<p>
An exception is raised in UCS2LEToUTF8 if the length of the converted string is longer than 1.5 times the original string length.
</p>
<p>
The return value is cast to a RawByteString type, and SetCodePage is called to set the code page to CP_UTF8 (65001) in the result.
</p>
<p>
No actions are performed in the routine when s is an empty string (''), and the return value is an empty string.
</p>
</descr>
<seealso>
<link id="#lazutils.lazutf8.UnicodeToUTF8SkipErrors">UnicodeToUTF8SkipErrors</link>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
<link id="#rtl.system.LEToN">LEToN</link>
</seealso>
</element>
<element name="UCS2LEToUTF8.Result">
<short>String value after conversion to UTF-8 encoding.</short>
</element>
<element name="UCS2LEToUTF8.s">
<short>String value using UCS2 LE encoding.</short>
</element>
<element name="UCS2BEToUTF8">
<short>Converts a string from UCS 2-byte BE encoding to UTF-8.</short>
<descr>
<p>
<var>UCS2BEToUTF8</var> is a <var>String</var> function used to convert a value encoded using UCS2 BE (Big Endian) to its UTF-8 encoding. UCS2 is a fixed-length encoding where each character is represented using 2 bytes (16-bits). Byte values are stored in Most Significant (Big Endian) byte order.
</p>
<p>
UCS2BEToUTF8 iterates over the characters in the string value, and converts each character to the variable length multi-byte encoding used for characters in UTF-8. BEToN is called to convert the byte values to the byte order used for the platform. The UnicodeToUTF8SkipErrors routine in <file>lazutf8.pas</file> is called to handle code points which are malformed, require translation or are not used in UTF-8.
</p>
<p>
An exception is raised in UCS2BEToUTF8 if the length of the converted string is longer than 1.5 times the original string length.
</p>
<p>
The return value is cast to a RawByteString type, and SetCodePage is called to set the code page to CP_UTF8 (65001) in the result.
</p>
<p>
No actions are performed in the routine when s is an empty string (''), and the return value is an empty string.
</p>
</descr>
<seealso>
<link id="#lazutils.lazutf8.UnicodeToUTF8SkipErrors">UnicodeToUTF8SkipErrors</link>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
<link id="#rtl.system.BEToN">BEToN</link>
</seealso>
</element>
<element name="UCS2BEToUTF8.Result">
<short>String value after conversion to UTF-8 encoding.</short>
</element>
<element name="UCS2BEToUTF8.s">
<short>String value using UCS2 BE encoding.</short>
</element>
<element name="UTF8ToUTF8BOM">
<short>Converts a string from UTF-8 encoding to UTF-8 with a Byte Order Mark.</short>
<descr>
<p>
UTF8ToUTF8BOM simply prepends the byte values in UTF8BOM to the value passed in the s argument. No actual encoding conversion is required. The return value contains the concatenated values.
</p>
</descr>
<seealso>
<link id="UTF8BOM"/>
</seealso>
</element>
<element name="UTF8ToUTF8BOM.Result">
<short>UTF-8-encoded string value after the BOM is inserted at the beginning of the string.</short>
</element>
<element name="UTF8ToUTF8BOM.s">
<short>UTF8-encoded string value updated in the routine.</short>
</element>
<element name="UTF8ToISO_8859_1">
<short>Converts a string from UTF-8 encoding to ISO 8859-1.</short>
<descr>
<p>
<var>UTF8ToISO_8859_1</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the ISO 8859-1 (Central European) encoding.
</p>
<p>
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.
</p>
<p>
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToISO_8859_1 to perform character conversions needed for the target encoding.
</p>
<p>
UTF8ToISO_8859_1 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToISO_8859_1.Result">
<short>String value after conversion to ISO 8859-1.</short>
</element>
<element name="UTF8ToISO_8859_1.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToISO_8859_1.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if the default system code page (CP_ACP) is used.
</short>
</element>
<element name="UTF8ToISO_8859_15">
<short>Converts a string from UTF-8 encoding to ISO 8859-15.</short>
<descr>
<p>
<var>UTF8ToISO_8859_15</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the ISO 8859-15 (Western European) encoding.
</p>
<p>
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.
</p>
<p>
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToISO_8859_15 to perform character conversions needed for the target encoding.
</p>
<p>
UTF8ToISO_8859_15 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToISO_8859_15.Result">
<short>String value after conversion to ISO 8859-15.</short>
</element>
<element name="UTF8ToISO_8859_15.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToISO_8859_15.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if the default system code page (CP_ACP) is used.
</short>
</element>
<element name="UTF8ToISO_8859_2">
<short>Converts a string from UTF-8 encoding to ISO 8859-2.</short>
<descr>
<p>
<var>UTF8ToISO_8859_2</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the ISO 8859-2 (Eastern European) encoding.
</p>
<p>
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.
</p>
<p>
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToISO_8859_2 to perform character conversions needed for the target encoding.
</p>
<p>
UTF8ToISO_8859_2 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToISO_8859_2.Result">
<short>String value after conversion to ISO 8859-2.</short>
</element>
<element name="UTF8ToISO_8859_2.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToISO_8859_2.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if the default system code page (CP_ACP) is used.
</short>
</element>
<element name="UTF8ToCP1250">
<short>Converts a string from UTF-8 encoding to Code Page 1250.</short>
<descr>
<p>
<var>UTF8ToCP1250</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the Code Page 1250 (Central European) encoding.
</p>
<p>
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.
</p>
<p>
UTF8ToCP1250 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP1250.Result">
<short>String value after conversion to Code Page 1250.</short>
</element>
<element name="UTF8ToCP1250.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToCP1250.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToCP1251">
<short>Converts a string from UTF-8 encoding to Code Page 1251.</short>
<descr>
<p>
<var>UTF8ToCP1251</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the Code Page 1251 (Cyrillic) encoding.
</p>
<p>
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.
</p>
<p>
UTF8ToCP1251 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP1251.Result">
<short>String value after conversion to Code Page 1251.</short>
</element>
<element name="UTF8ToCP1251.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToCP1251.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToCP1252">
<short>Converts a string from UTF-8 encoding to Code Page 1252.</short>
<descr>
<p>
<var>UTF8ToCP1252</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the Code Page 1252 (Latin 1) encoding.
</p>
<p>
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.
</p>
<p>
UTF8ToCP1252 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP1252.Result">
<short>String value after conversion to Code Page 1252.</short>
</element>
<element name="UTF8ToCP1252.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToCP1252.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToCP1253">
<short>Converts a string from UTF-8 encoding to Code Page 1253.</short>
<descr>
<p>
<var>UTF8ToCP1253</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the Code Page 1253 (Greek) encoding.
</p>
<p>
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.
</p>
<p>
UTF8ToCP1253 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP1253.Result">
<short>String value after conversion to Code Page 1253.</short>
</element>
<element name="UTF8ToCP1253.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToCP1253.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToCP1254">
<short>Converts a string from UTF-8 encoding to Code Page 1254.</short>
<descr>
<p>
<var>UTF8ToCP1254</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the Code Page 1254 (Turkish) encoding.
</p>
<p>
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.
</p>
<p>
UTF8ToCP1254 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP1254.Result">
<short>String value after conversion to Code Page 1254.</short>
</element>
<element name="UTF8ToCP1254.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToCP1254.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToCP1255">
<short>Converts a string from UTF-8 encoding to Code Page 1255.</short>
<descr>
<p>
<var>UTF8ToCP1255</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the Code Page 1255 (Hebrew) encoding.
</p>
<p>
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.
</p>
<p>
UTF8ToCP1255 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP1255.Result">
<short>String value after conversion to Code Page 1255.</short>
</element>
<element name="UTF8ToCP1255.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToCP1255.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToCP1256">
<short>Converts a string from UTF-8 encoding to Code Page 1256.</short>
<descr>
<p>
<var>UTF8ToCP1256</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the Code Page 1256 (Arabic) encoding.
</p>
<p>
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.
</p>
<p>
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToCP1256 to perform character conversions needed for the target encoding.
</p>
<p>
UTF8ToCP1256 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP1256.Result">
<short>String value after conversion to Code Page 1256.</short>
</element>
<element name="UTF8ToCP1256.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToCP1256.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if the default system code page (CP_ACP) is used.
</short>
</element>
<element name="UTF8ToCP1257">
<short>Converts a string from UTF-8 encoding to Code Page 1257.</short>
<descr>
<p>
<var>UTF8ToCP1257</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the Code Page 1257 (Baltic) encoding.
</p>
<p>
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.
</p>
<p>
UTF8ToCP1255 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP1257.Result">
<short>String value after conversion to Code Page 1257.</short>
</element>
<element name="UTF8ToCP1257.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToCP1257.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToCP1258">
<short>Converts a string from UTF-8 encoding to Code Page 1258.</short>
<descr>
<p>
<var>UTF8ToCP1258</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the Code Page 1258 (Vietnamese) encoding.
</p>
<p>
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.
</p>
<p>
UTF8ToCP1258 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP1258.Result">
<short>String value after conversion to Code Page 1258.</short>
</element>
<element name="UTF8ToCP1258.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToCP1258.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToCP437">
<short>Converts a string from UTF-8 encoding to Code Page 437.</short>
<descr>
<p>
<var>UTF8ToCP437</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the Code Page 437 (DOS Latin US) encoding.
</p>
<p>
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.
</p>
<p>
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToCP437 to perform character conversions needed for the target encoding.
</p>
<p>
UTF8ToCP437 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP437.Result">
<short>String value after conversion to Code Page 437.</short>
</element>
<element name="UTF8ToCP437.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToCP437.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToCP850">
<short>Converts a string from UTF-8 encoding to Code Page 850.</short>
<descr>
<p>
<var>UTF8ToCP850</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the Code Page 850 (DOS Western Europe) encoding.
</p>
<p>
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.
</p>
<p>
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToCP850 to perform character conversions needed for the target encoding.
</p>
<p>
UTF8ToCP850 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP850.Result">
<short>String value after conversion to Code Page 850.</short>
</element>
<element name="UTF8ToCP850.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToCP850.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToCP852">
<short>Converts a string from UTF-8 encoding to Code Page 852.</short>
<descr>
<p>
<var>UTF8ToCP852</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the Code Page 852 (DOS Central Europe) encoding.
</p>
<p>
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.
</p>
<p>
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToCP852 to perform character conversions needed for the target encoding.
</p>
<p>
UTF8ToCP852 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP852.Result">
<short>String value after conversion to Code Page 852.</short>
</element>
<element name="UTF8ToCP852.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToCP852.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToCP866">
<short>Converts a string from UTF-8 encoding to Code Page 866.</short>
<descr>
<p>
<var>UTF8ToCP866</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the Code Page 866 (DOS Cyrillic Russian) encoding.
</p>
<p>
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.
</p>
<p>
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToCP866 to perform character conversions needed for the target encoding.
</p>
<p>
UTF8ToCP866 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP866.Result">
<short>String value after conversion to Code Page 866.</short>
</element>
<element name="UTF8ToCP866.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToCP866.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToCP874">
<short>Converts a string from UTF-8 encoding to Code Page 874.</short>
<descr>
<p>
<var>UTF8ToCP874</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the Code Page 874 (Thai) encoding.
</p>
<p>
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.
</p>
<p>
UTF8ToCP874 is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="UTF8ToSingleByte"/>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP874.Result">
<short>String value after conversion to Code Page 874.</short>
</element>
<element name="UTF8ToCP874.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToCP874.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToKOI8R">
<short>Converts a string from UTF-8 encoding to KOI8-R encoding.</short>
<descr>
<p>
<var>UTF8ToKOI8R</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the KOI8-R (Russian Cyrillic 8-bit) encoding. KOI8R stands for Kod Obmena Informatsiey, 8-bit Russian.
</p>
<p>
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.
</p>
<p>
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToKOI8R to perform character conversions needed for the target encoding.
</p>
<p>
UTF8ToKOI8R is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8ToKOI8R.Result">
<short>String value after conversion to KOI8-R encoding.</short>
</element>
<element name="UTF8ToKOI8R.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToKOI8R.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToKOI8U">
<short>Converts a string from UTF-8 encoding to KOI8-U encoding.</short>
<descr>
<p>
<var>UTF8ToKOI8U</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the KOI8-U (Russian Ukranian 8-bit) encoding. KOI8R stands for Kod Obmena Informatsiey, 8-bit Ukranian.
</p>
<p>
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.
</p>
<p>
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToKOI8U to perform character conversions needed for the target encoding.
</p>
<p>
UTF8ToKOI8U is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8ToKOI8U.Result">
<short>String value after conversion to KOI8-U encoding.</short>
</element>
<element name="UTF8ToKOI8U.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToKOI8U.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToKOI8RU">
<short>Converts a string from UTF-8 encoding to KOI8-RU encoding.</short>
<descr>
<p>
<var>UTF8ToKOI8RU</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the KOI8RU (Russian, Belarusian, Ukranian Cyrillic) encoding.
</p>
<p>
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.
</p>
<p>
UTF8ToKOI8RU is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8ToKOI8RU.Result">
<short>String value after conversion to KOI8-RU encoding.</short>
</element>
<element name="UTF8ToKOI8RU.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToKOI8RU.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToMacintosh">
<short>Converts a value from UTF-8 encoding to the Macintosh Code Page.</short>
<descr>
<p>
<var>UTF8ToMacintosh</var> is a <var>RawByteString</var> function used to convert a UTF-8-encoded string to the Apple Macintosh Roman code page.
</p>
<p>
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.
</p>
<p>
For other platforms, the UTF8ToSingleByte routine is called using UnicodeToMacintosh to perform character conversions needed for the target encoding.
</p>
<p>
UTF8ToMacintosh is used in the implementation of the ConvertEncodingFromUTF8 encoding conversion routine.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8ToMacintosh.Result">
<short>String value after conversion to Macintosh encoding.</short>
</element>
<element name="UTF8ToMacintosh.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToMacintosh.SetTargetCodePage">
<short>
True if the target code page is set in the return value, False if a code page is not used.
</short>
</element>
<element name="UTF8ToSingleByte">
<short>
Converts a UTF-8-encoded string value to a single-bye character set using a conversion function.
</short>
<descr>
<p>
UTF8ToSingleByte is used in an internal routine to convert the UTF-8-encoded value in s by calling the custom conversion routine in UTF8CharConvFunc. The return value is a string with the single-byte representation for the string value. UTF8ToSingleByte is called when the UseSystemCPConv compiler flag has not been defined for the platform, and system code pages are not availabe for the purpose.
</p>
<p>
No actions are performed in the routine when s is an empty string (''), and the return value is set to an empty string.
</p>
<p>
UTF8ToSingleByte iterates over the Unicode codepoints in s, and calls the routine in UTF8CharConvFunc for each of the codepoints. If a codepoint is not handled by the UTF8CodepointToUnicode routine, the value in ConvertEncodingErrorMode is used to determine the action taken for the character value. This includes:
</p>
<dl>
<dt>ceemSkip</dt>
<dd>The character value is ignored.</dd>
<dt>ceemReplace</dt>
<dd>Inserts a '?' character for the unknown codepoint.</dd>
<dt>ceemReturnEmpty</dt>
<dd>Returns an empty string ('') for the conversion routine.</dd>
<dt>ceemException</dt>
<dd>Raises an EConvertError exception with the message 'Cannot convert UTF8 to single byte'.</dd>
</dl>
<p>
UTF8ToSingleByte is called from an internal conversion routine, and occurs when the following routines are executed:
</p>
<ul>
<li>UTF8ToISO_8859_1</li>
<li>UTF8ToISO_8859_2</li>
<li>UTF8ToISO_8859_15</li>
<li>UTF8ToCP1250</li>
<li>UTF8ToCP1251</li>
<li>UTF8ToCP1252</li>
<li>UTF8ToCP1253</li>
<li>UTF8ToCP1254</li>
<li>UTF8ToCP1255</li>
<li>UTF8ToCP1256</li>
<li>UTF8ToCP1257</li>
<li>UTF8ToCP1258</li>
<li>UTF8ToCP437</li>
<li>UTF8ToCP850</li>
<li>UTF8ToCP852</li>
<li>UTF8ToCP866</li>
<li>UTF8ToCP874</li>
<li>UTF8ToKOI8R</li>
<li>UTF8ToKOI8U</li>
<li>UTF8ToKOI8RU</li>
<li>UTF8ToMacintosh</li>
</ul>
</descr>
<seealso>
<link id="ConvertEncodingFromUTF8"/>
<link id="ConvertEncoding"/>
</seealso>
</element>
<element name="UTF8ToSingleByte.Result">
<short>String value after conversion to an encoding using a single-byte character set.</short>
</element>
<element name="UTF8ToSingleByte.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToSingleByte.UTF8CharConvFunc">
<short>Routine used translate Unicode code points to the singe-byte character set for the encoding.</short>
</element>
<element name="UTF8ToUCS2LE">
<short>Converts a UTF-8-encoded value to UCS 2-byte Little Endian encoding.</short>
<descr>
<p>
UTF8ToUCS2LE 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 LE (Little Endian) encoding. UTF8ToUCS2LE iterates over each of the UTF-8 codepoints in s, and calls NtoLE to convert the Unicode character value to the Least Signifcant byte order used in the encoding. Unicode characters with a value $FFFF or greater are ignored in the conversion.
</p>
<p>
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.
</p>
<p>
UTF8ToUCS2LE does not include a byte order mark (BOM) in the UCS2-encoded output.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8ToUCS2LE.Result">
<short>String value after conversion to UCS2 LE encoding.</short>
</element>
<element name="UTF8ToUCS2LE.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="UTF8ToUCS2BE">
<short>Converts a UTF-8-encoded value to UCS 2-byte Big Endian encoding.</short>
<descr>
<p>
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 Signifcant byte order used in the encoding. Unicode characters with a value $FFFF or greater are ignored in the conversion.
</p>
<p>
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.
</p>
<p>
UTF8ToUCS2BE does not include a byte order mark (BOM) in the UCS2-encoded output.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8ToUCS2BE.Result">
<short>String value after conversion to UCS2 BE encoding.</short>
</element>
<element name="UTF8ToUCS2BE.s">
<short>UTF-8-encoded string value converted in the routine.</short>
</element>
<element name="CP932ToUTF8">
<short>Converts a string value using Code Page 932 to UTF-8.</short>
<descr>
<p>
CP932ToUTF8 is defined for platforms where Asian code pages are enabled.
</p>
</descr>
<seealso/>
</element>
<element name="CP932ToUTF8.Result">
<short>String value after conversion to UTF-8 encoding.</short>
</element>
<element name="CP932ToUTF8.s">
<short>String value using code page 932.</short>
</element>
<element name="CP936ToUTF8">
<short>Converts a string value using Code Page 936 to UTF-8.</short>
<descr>
<p>
CP936ToUTF8 is defined for platforms where Asian code pages are enabled.
</p>
</descr>
<seealso/>
</element>
<element name="CP936ToUTF8.Result">
<short>String value after conversion to UTF-8 encoding.</short>
</element>
<element name="CP936ToUTF8.s">
<short>String value using code page 936.</short>
</element>
<element name="CP949ToUTF8">
<short>Converts a string value using Code Page 949 to UTF-8.</short>
<descr>
<p>
CP949ToUTF8 is defined for platforms where Asian code pages are enabled.
</p>
</descr>
<seealso/>
</element>
<element name="CP949ToUTF8.Result">
<short>String value after conversion to UTF-8 encoding.</short>
</element>
<element name="CP949ToUTF8.s">
<short>String value using code page 949.</short>
</element>
<element name="CP950ToUTF8">
<short>Converts a string value using Code Page 950 to UTF-8.</short>
<descr>
<p>
CP950ToUTF8 is defined for platforms where Asian code pages are enabled.
</p>
</descr>
<seealso/>
</element>
<element name="CP950ToUTF8.Result">
<short>String value after conversion to UTF-8 encoding.</short>
</element>
<element name="CP950ToUTF8.s">
<short>String value using code page 950.</short>
</element>
<element name="UTF8ToCP932">
<short>Converts a string from UTF-8 encoding to Code Page 932.</short>
<descr>
<p>
UTF8ToCP932 is defined for platforms where Asian code pages are enabled.
</p>
</descr>
<seealso>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP932.Result">
<short>String value after conversion to code page 932.</short>
</element>
<element name="UTF8ToCP932.s">
<short>String value using UTF-8 encoding.</short>
</element>
<element name="UTF8ToCP932.SetTargetCodePage">
<short>True to set the code page for the result, Falase to use the ANSI code page.</short>
</element>
<element name="UTF8ToCP936">
<short>Converts a string from UTF-8 encoding to Code Page 936.</short>
<descr>
<p>
UTF8ToCP936 is defined for platforms where Asian code pages are enabled.
</p>
</descr>
<seealso>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP936.Result">
<short>String value after conversion to code page 936.</short>
</element>
<element name="UTF8ToCP936.s">
<short>String value using UTF-8 encoding.</short>
</element>
<element name="UTF8ToCP936.SetTargetCodePage">
<short>True to set the code page for the result, Falase to use the ANSI code page.</short>
</element>
<element name="UTF8ToCP949">
<short>Converts a string from UTF-8 encoding to Code Page 949.</short>
<descr>
<p>
UTF8ToCP949 is defined for platforms where Asian code pages are enabled.
</p>
</descr>
<seealso>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP949.Result">
<short>String value after conversion to code page 949.</short>
</element>
<element name="UTF8ToCP949.s">
<short>String value using UTF-8 encoding.</short>
</element>
<element name="UTF8ToCP949.SetTargetCodePage">
<short>True to set the code page for the result, Falase to use the ANSI code page.</short>
</element>
<element name="UTF8ToCP950">
<short>Converts a string from UTF-8 encoding to Code Page 950.</short>
<descr>
<p>
UTF8ToCP950 is defined for platforms where Asian code pages are enabled.
</p>
</descr>
<seealso>
<link id="#rtl.system.SetCodePage">SetCodePage</link>
</seealso>
</element>
<element name="UTF8ToCP950.Result">
<short>String value after conversion to code page 949.</short>
</element>
<element name="UTF8ToCP950.s">
<short>String value using UTF-8 encoding.</short>
</element>
<element name="UTF8ToCP950.SetTargetCodePage">
<short>True to set the code page for the result, Falase to use the ANSI code page.</short>
</element>
<element name="UTF8ToDBCS">
<short>
Converts a value from UTF-8 encoding to a Double Byte Character Set encoding.
</short>
<descr>
<p>
Defined for platforms where Asian code pages are enabled. This is a common function used in all conversion routines which convert UTF-8 to an Asian code page.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8ToDBCS.Result">
<short>String value using the double-byte character set generated in the conversion function.</short>
</element>
<element name="UTF8ToDBCS.s">
<short>String value using UTF-8 encoding.</short>
</element>
<element name="UTF8ToDBCS.UTF8CharConvFunc">
<short>Conversion routine used to translate characters to the double-byte encoding used in the result.</short>
</element>
<element name="GetSupportedEncodings">
<short>Adds supported encoding names for the platform to the specified string list.</short>
<descr>
<p>
<var>GetSupportedEncodings</var> 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 <var>List</var>; it does <b>NOT</b> removing any existing content in the string list.
</p>
<p>
GetSupportedEncodings stores the following values in the List argument:
</p>
<ul>
<li>'UTF-8'</li>
<li>'UTF-8BOM'</li>
<li>'Ansi'</li>
<li>'cp1250' (EncodingCP1250)</li>
<li>'cp1251' (EncodingCP1251)</li>
<li>'cp1252' (EncodingCP1252)</li>
<li>'cp1253' (EncodingCP1253)</li>
<li>'cp1254' (EncodingCP1254)</li>
<li>'cp1255' (EncodingCP1255)</li>
<li>'cp1256' (EncodingCP1256)</li>
<li>'cp1257' (EncodingCP1257)</li>
<li>'cp1258' (EncodingCP1258)</li>
<li>'cp437' (EncodingCP437)</li>
<li>'cp850' (EncodingCP850)</li>
<li>'cp852' (EncodingCP852)</li>
<li>'cp866' (EncodingCP866)</li>
<li>'cp874' (EncodingCP874)</li>
</ul>
<p>
For platforms that support Asian code pages, the following encoding names are added to the list:
</p>
<ul>
<li>'cp932' (EncodingCP932)</li>
<li>'cp936' (EncodingCP936)</li>
<li>'cp950' (EncodingCP950)</li>
<li>'cp949' (EncodingCP949)</li>
</ul>
<p>
The following encoding names are added to the end of the list:
</p>
<ul>
<li>'ISO-8859-1'</li>
<li>'ISO-8859-2'</li>
<li>'ISO-8859-15'</li>
<li>'KOI8-R'</li>
<li>'KOI8-U'</li>
<li>'KOI8-RU'</li>
<li>'Macintosh'</li>
<li>'UCS-2LE'</li>
<li>'UCS-2BE'</li>
</ul>
</descr>
<seealso/>
</element>
<element name="GetSupportedEncodings.List">
<short>String list updated with the supported encoding names.</short>
</element>
</module>
<!-- LConvEncoding -->
</package>
</fpdoc-descriptions>
|