File: lazutf8.xml

package info (click to toggle)
lazarus 4.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 275,760 kB
  • sloc: pascal: 2,341,904; xml: 509,420; makefile: 348,726; cpp: 93,608; sh: 3,387; java: 609; perl: 297; sql: 222; ansic: 137
file content (3233 lines) | stat: -rw-r--r-- 98,635 bytes parent folder | download
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
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
<?xml version="1.0" encoding="UTF-8"?>
<!--

Documentation for LCL (Lazarus Component Library) and LazUtils (Lazarus 
Utilities) are published under the Creative Commons Attribution-ShareAlike 4.0 
International public license.

https://creativecommons.org/licenses/by-sa/4.0/legalcode.txt
https://gitlab.com/freepascal.org/lazarus/lazarus/-/blob/main/docs/cc-by-sa-4-0.txt

Copyright (c) 1997-2025, by the Lazarus Development Team.

-->
<fpdoc-descriptions>
<package name="lazutils">
<!--
====================================================================
LazUTF8
====================================================================
-->
<module name="LazUTF8">
<short>
Routines for managing UTF-8-encoded strings.
</short>
<descr>
<p>
<file>lazutf8.pas</file> contains useful routines for managing UTF-8-encoded 
strings. All routines are thread-safe unless explicitly stated.
</p>
<p>
<file>lazutf8.pas</file> is part of the <file>LazUtils</file> package.
</p>
</descr>

<!-- unresolved externals -->
<element name="cwstring"/>
<element name="FPCAdds"/>
<element name="Windows"/>
<element name="Classes"/>
<element name="SysUtils"/>
<element name="StrUtils"/>

<element name="NeedRTLAnsi">
<short>
Indicates if the OS requires use of AnsiToUTF8 and UTF8ToAnsi for the RTL.
</short>
<descr>
<p>
<var>NeedRTLAnsi</var> is a <var>Boolean</var> function that indicates if the 
OS requires use of <var>AnsiToUTF8</var> and <var>UTF8ToAnsi</var> for the 
RTL. AnsiToUTF8 and UTF8ToAnsi need a widestring manager under Linux, BSD, 
and Mac OSX. Normally these OS's use UTF-8 as the system encoding so the 
<var>WideStringManager</var> is not needed.
</p>
<p>
For the Windows environment, NeedRTLAnsi is <b>True</b> if the default system 
code page is not <var>CP_UTF8</var>. For UNIX-like environments, NeedRTLAnsi 
is <b>True</b> when any of the <b>LC_ALL</b>, <b>LC_MESSAGES</b>, or 
<b>LANG</b> environment variables contain a language code other than UTF-8.
</p>
</descr>
<seealso>
<link id="#rtl.system.DefaultSystemCodePage">DefaultSystemCodePage</link>
</seealso>
</element>
<element name="NeedRTLAnsi.Result">
<short>True when the system encoding is not UTF-8.</short>
</element>

<element name="SetNeedRTLAnsi">
<short>Sets the value for the unit global variable.</short>
<descr></descr>
<seealso>
<link id="NeedRTLAnsi"/>
</seealso>
</element>
<element name="SetNeedRTLAnsi.NewValue">
<short>New value for the variable.</short>
</element>

<element name="UTF8ToSys">
<short>
Ensures UTF-8 characters (or format settings) are converted to the system 
code page.
</short>
<descr>
<p>
<var>UTF8ToSys</var> is an overloaded function used to convert the specified 
string value (or format settings) to the system codepage for the platform. 
UTF8ToSys works like <var>UTF8ToAnsi</var>, but is more independent of 
WideStringManager. For platforms where UTF8_RTL is not defined, and 
NeedRTLAnsi returns <b>True</b>, UTF8ToAnsi is called to convert non-ASCII 
values in <var>s</var>. For platforms where UTF8_RTL is defined, the value in 
s is used without modification.
</p>
<p>
An overloaded variant of the function handles <var>TFormatSettings</var> for 
the platform. The return value for the function is the specified values in 
<var>AFormatSettings</var> after being updated to reflect the system codepage 
for the platform. For platforms where UTF8_RTL is not defined, the values in 
the following format settings are updated: <var>CurrencyString</var>, 
<var>LongMonthNames</var>, <var>ShortMonthNames</var>, 
<var>LongDayNames</var>, and <var>ShortDayNames</var>.
</p>
<p>
No actions are needed for platforms where UTF8_RTL is defined.
</p>
</descr>
<seealso>
<link id="#rtl.system.Utf8ToAnsi">Utf8ToAnsi</link>
<link id="#rtl.sysutils.TFormatSettings">TFormatSettings</link>
</seealso>
</element>
<element name="UTF8ToSys.Result">
<short>Value for the string after conversion.</short>
</element>
<element name="UTF8ToSys.s">
<short>Value to examine in the function.</short>
</element>
<element name="UTF8ToSys.AFormatSettings">
<short>Format settings to examine in the function.</short>
</element>

<element name="SysToUTF8">
<short>
Converts strings (and format settings) from the system codepage to UTF-8.
</short>
<descr>
<p>
<var>SysToUTF8</var> is an overloaded function used to convert strings (and 
format settings) from the system codepage to UTF-8. SysToUTF8 works like 
<var>AnsiToUTF8</var>, but has no reliance on the widestring manager on 
platforms where UTF8_RTL is defined. For platforms where UTF8_RTL is not 
defined, and NeedRTLAnsi contains <b>True</b>, non-ASCII values are converted 
to UTF-8 by calling <var>AnsiToUTF8</var>.
</p>
<p>
An overloaded variant of the function handles <var>TFormatSettings</var> for 
the platform. The return value for the function is the values specified in 
AFormatSettings after conversion from the system codepage to UTF-8. The 
values in the following format settings are updated: 
<var>CurrencyString</var>, <var>LongMonthNames</var>, 
<var>ShortMonthNames</var>, <var>LongDayNames</var>, and 
<var>ShortDayNames</var>.
</p>
</descr>
<seealso>
<link id="#rtl.system.AnsiToUTF8">AnsiToUTF8</link>
<link id="#rtl.sysutils.TFormatSettings">TFormatSettings</link>
</seealso>
</element>
<element name="SysToUTF8.Result">
<short>Values after conversion to UTF-8.</short>
</element>
<element name="SysToUTF8.s">
<short>Values to examine in the function.</short>
</element>
<element name="SysToUTF8.AFormatSettings">
<short>Format settings to examine in the function.</short>
</element>

<element name="ConsoleToUTF8">
<short>
Converts an OEM-encoded string to UTF8.
</short>
<descr>
<p>
<var>ConsoleToUTF8</var> is a <var>String</var> function used to converts an 
OEM-encoded string to UTF8. The implementation of ConsoleToUTF8 is 
OS-specific, and essentially handles differences between various Windows 
platforms where use of <var>OemToChar</var> and <var>WinCPToUTF8</var> are 
required. For UNIX-like environments, the value in s is converted by calling 
<var>SysToUTF8</var>.
</p>
<p>
ConsoleToUTF8 is used in the implementation of the 
<var>GetEnvironmentStringUTF8</var> and <var>GetEnvironmentVariableUTF8</var> 
functions.
</p>
</descr>
<seealso>
<link id="SysToUTF8"/>
<link id="WinCPToUTF8"/>
<link id="GetEnvironmentStringUTF8"/>
<link id="GetEnvironmentVariableUTF8"/>
</seealso>
</element>
<element name="ConsoleToUTF8.Result">
<short>UTF-8-encoded value for the specified string.</short>
</element>
<element name="ConsoleToUTF8.s">
<short>Value to convert in the function.</short>
</element>

<element name="UTF8ToConsole">
<short>
Converts a UTF-8-encoded string to console (OEM) encoding.
</short>
<descr>
<p>
<var>UTF8ToConsole</var> converts a UTF-8-encoded string to console (OEM) 
encoding as used in <var>Write</var> and <var>WriteLn</var>. The 
implementation is platform specific.
</p>
<p>
For the Windows environment, either <var>UTF8ToSys</var> or 
<var>UTF8ToWinCP</var> is used to convert the value to the codepage or 
character set needed in RTL. The Windows <var>CharToOem</var> API is used to 
prepare the return value. In UNIX-like environments, <var>UTF8ToSys</var> is 
used to get the return value .
</p>
</descr>
<seealso>
<link id="UTF8ToSys"/>
<link id="UTF8ToWinCP"/>
</seealso>
</element>
<element name="UTF8ToConsole.Result">
<short>OEM-encoded value for the string.</short>
</element>
<element name="UTF8ToConsole.s">
<short>UTF-8-encode input values.</short>
</element>

<element name="WinCPToUTF8">
<short>
Converts the string from Windows code page to UTF-8.
</short>
<descr>
<p>
Converts the string from Windows code page to UTF-8. Used with some 
Windows-specific functions. For all Windows versions supporting 8-bit 
codepages (but not WinCE).
</p>
</descr>
<seealso/>
</element>
<element name="WinCPToUTF8.Result">
<short>UTF-8-encoded values for the string.</short>
</element>
<element name="WinCPToUTF8.s">
<short>Input values in Windows codepage encoding.</short>
</element>

<element name="UTF8ToWinCP">
<short>
Converts the UTF-8-encoded string to the Windows code page encoding.
</short>
<descr>
<p>
Converts the UTF-8-encoded string to the Windows code page encoding Used by 
<var>Write</var> and <var>WriteLn</var>.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8ToWinCP.Result">
<short>UTF-8-encoded input values.</short>
</element>
<element name="UTF8ToWinCP.s">
<short>Values in the Windows codepage encoding.</short>
</element>

<element name="ParamStrUTF8">
<short>
Gets the specified command line parameter and converts it to a UTF-8-encoded 
string.
</short>
<descr>
<p>
<var>ParamStrUTF8</var> is a <var>String</var> function used to convert the 
specified command line parameter to a UTF-8-encoded string. The 
implementation for ParamStrUTF8 is OS- or platform-specific. For UNIX-like 
environments, SysToUTF8 is called to convert the value for the command line 
parameter at the position in Param. For Windows platforms, the stub for the 
Ansi or WideString version of ParamStrUTF8 is called. ParamStrUTF8 is the 
UTF-8-enabled counterpart to the ParamStr routine in RTL.
</p>
<p>
<var>Index</var> is the ordinal position for the requested parameter value. 
Index should be in the range <b>0..<var>ParamCount</var></b>. Values in Index 
outside this range cause an empty string ('') to be returned for a parameter 
value.
</p>
<p>
In most cases, the parameter at position <b>0</b> contains the name and 
optional path to the executable file for the application. For cross-platform 
compatibility, use the ExeName property in TCustomApplication to get the path 
and name for the binary instead. Subsequent index positions contain any command 
line arguments passed to the executable.
</p>
<p>
The return value contains the UTF-8-encoded string with the value for the 
parameter at the specified position, or an empty string when not present.
</p>
</descr>
<seealso>
<link id="SysToUTF8"/>
<link id="#fcl.custapp.TCustomApplication.ExeName">TCustomApplication.ExeName</link>
<link id="#rtl.system.ParamStr">ParamStr</link>
</seealso>
</element>
<element name="ParamStrUTF8.Result">
<short>
UTF-8-encoded value for the specified command line parameter.
</short>
</element>
<element name="ParamStrUTF8.Param">
<short>
Ordinal position for the command line parameter retrieved in the routine.
</short>
</element>

<element name="GetFormatSettingsUTF8">
<short>
Gets the TFormatSettings for the platform.
</short>
<descr>
<p>
<var>GetFormatSettingsUTF8</var> is a procedure used to get the 
<var>TFormatSettings</var> for the Locale or Language Code for the platform. 
GetFormatSettingsUTF8 is defined for Windows environments only, and calls 
<var>GetLocaleFormatSettingsUTF8</var> using the ThreadLocale or Language 
Code ID needed for the platform.
</p>
</descr>
<seealso>
<link id="GetFormatSettingsUTF8"/>
<link id="GetLocaleFormatSettingsUTF8"/>
</seealso>
</element>

<element name="GetLocaleFormatSettingsUTF8">
<short>
Gets format settings for a specific Language Code ID.
</short>
<descr>
<p>
<var>GetLocaleFormatSettingsUTF8</var> is a procedure used to get the 
<var>TFormatSettings</var> for the Locale or Language Code for the platform. 
GetLocaleFormatSettingsUTF8 is defined for Windows environments only. 
</p>
<p>
GetLocaleFormatSettingsUTF8 ensures that values in the format settings use 
the Language Code ID for the platform. The following format settings are 
converted to their Locale-specific values:
</p>
<ul>
<li>ShortMonthNames</li>
<li>LongMonthNames</li>
<li>ShortDayName</li>
<li>LongDayName</li>
<li>DateSeparator</li>
<li>ShortDateFormat</li>
<li>LongDateFormat</li>
<li>TimeSeparator</li>
<li>TimeAMString</li>
<li>TimePMString</li>
<li>ShortTimeFormat</li>
<li>LongTimeFormat</li>
<li>CurrencyString</li>
<li>CurrencyFormat</li>
<li>NegCurrFormat</li>
<li>ThousandSeparator</li>
<li>DecimalSeparator</li>
<li>CurrencyDecimals</li>
<li>ListSeparator</li>
</ul>
<p>
In LCL version 3.0 or higher, LongTimeFormat and ShortTimeFormat can contain 
AM / PM format specifiers; i. e. 'hh:nn:ss AMPM'
</p>
</descr>
<version>
Modified in LCL version 3.0 to return 12-hour time formats using AM / PM in 
format settings.
</version>
<seealso>
<link id="#rtl.sysutils.TFormatSettings">TFormatSettings</link>
</seealso>
</element>
<element name="GetLocaleFormatSettingsUTF8.LCID">
<short>Language Code ID.</short>
</element>
<element name="GetLocaleFormatSettingsUTF8.AFormatSettings">
<short>The locale-specific format settings for the platform.</short>
</element>

<element name="GetEnvironmentVariableCountUTF8">
<short>
Returns the number of system environment variables.
</short>
<descr>
<p>
Returns the number of UTF-8-encoded system environment variables. Used 
together with <var>GetEnvironmentStringUTF8</var>.
</p>
</descr>
</element>
<element name="GetEnvironmentVariableCountUTF8.Result">
<short>Number of variables in the system environment.</short>
</element>

<element name="GetEnvironmentStringUTF8">
<short>
Returns a system environment string.
</short>
<descr>
<p>
Returns a UTF-8-encoded system environment string stored at the specified 
position. The value in <var>Index</var> is in the range 
1..GetEnvironmentVariableCountUTF8. For Unix and Windows the string normally 
is in the form 'name=value'. Beware that Windows knows some special formats, 
e.g. '=C:=SomePath'. Nota bene: Raymond Chen called these "bookkeeping 
variables" which emulate the MS-DOS tracking mechanism for the current 
directory on different drives.
</p>
<p>
Use <var>GetEnvironmentVariableUTF8</var> to lookup values for environment 
variables by name.
</p>
</descr>
</element>
<element name="GetEnvironmentStringUTF8.Result">
<short>Value for the environment variable at the specified position.</short>
</element>
<element name="GetEnvironmentStringUTF8.Index">
<short>Position for the environment variable.</short>
</element>

<element name="GetEnvironmentVariableUTF8">
<short>
Returns the value of a system environment variable.
</short>
<descr>
<p>
Returns the value of an environment variable stored in the form 
'EnvVar=value'. See <var>GetEnvironmentStringUTF8</var> to retrieve the whole 
list of environment strings.
</p>
</descr>
</element>
<element name="GetEnvironmentVariableUTF8.Result">
<short>Value for the specified environment variable name.</short>
</element>
<element name="GetEnvironmentVariableUTF8.EnvVar">
<short>Environment variable with the value retrieved in the routine.</short>
</element>

<element name="SysErrorMessageUTF8">
<short>
Gets the UTF-8-encoded system error message for the specified error code.
</short>
<descr>
<p>
<var>SysErrorMessageUTF8</var> is used to get the UTF-8-encoded system error 
message for the specified error code. SysErrorMessageUTF8 calls the 
<var>SysUtils.SysErrorMessage</var> function and converts the error message 
using <var>SysToUTF8</var>.
</p>
</descr>
<seealso/>
</element>
<element name="SysErrorMessageUTF8.Result">
<short>UTF-8-encoded value for the system error message.</short>
</element>
<element name="SysErrorMessageUTF8.ErrorCode">
<short>Numeric system error code for the message.</short>
</element>

<element name="UTF8CodepointSize">
<short>
Returns the size of the UTF-8 codepoint in bytes.
</short>
<descr>
<p>
Returns the size of the UTF-8 codepoint in bytes. The return value is for a 
single codepoint.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8CodepointSize.Result">
<short>Number of bytes for the codepoint.</short>
</element>
<element name="UTF8CodepointSize.p">
<short>UTF-8-encoded value to examine in the function.</short>
</element>

<element name="UTF8CodepointSizeFast">
<short>
Fast version of UTF8CodepointSize.
</short>
<descr>
<p>
Fast version of <var>UTF8CodepointSize</var>. Assumes the UTF-8 codepoint is 
valid. The return value is for a single codepoint.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8CodepointSizeFast.Result">
<short>Number of bytes for the codepoint.</short>
</element>
<element name="UTF8CodepointSizeFast.p">
<short>Encoded values to examine in the function.</short>
</element>

<element name="UTF8CharacterLength">
<short>
Returns the number of bytes needed for the UTF-8 codepoint starting at p.
</short>
<descr>
<remark>
Deprecated. Use UTF8CodepointSize instead.
</remark>
<p>
It returns 0 if p is nil. It returns 1 if p is a 1-byte UTF-8 codepoint or p 
is an invalid UTF-8 sequence. Otherwise it returns a number 2..4. It does not 
check for malicious codepoints like #$c0#$80, nor for undefined codepoints 
like #$f3#$a0#$87#$b9. Use UTF8CharacterLength to step through a string with 
a simple loop:
</p>
<code>
while p^ &lt;&gt; #0 do
begin
  inc(p, UTF8CharacterLength(p));
end;
</code>
<p>
Even if p contains invalid UTF-8 codepoints it will run through the string 
without overflow.
</p>
</descr>
<seealso>
<link id="UTF8CharacterStrictLength">UTF8CharacterStrictLength</link>
</seealso>
</element>
<element name="UTF8CharacterLength.Result">
<short>Number of bytes required for the UTF-8 codepoint, or 0 (zero).</short>
</element>
<element name="UTF8CharacterLength.p">
<short>Pointer to the value examined in the routine.</short>
</element>

<element name="UTF8Length">
<short>
Gets the length of a UTF-8-encoded string in codepoints.
</short>
<descr>
<p>
<var>UTF8Length</var> is a function used to get the character length for the 
specified UTF-8-encoded string. The return value contains the number of 
UTF-8-encoded characters (or codepoints) found in the byte values for the 
string.
</p>
<p>
An overloaded variant of the function is provided which uses the 
<var>PChar</var> type to specify the byte values in the string. Internally, 
the String variant casts its value a PChar type and calls the overloaded 
variant.
</p>
<p>
UTF8Length iterates over the bytes in the UTF-8-encoded string data, and 
calls UTF8CodepointSize to determine the number of bytes needed for each 
codepoint. Use UTF8LengthFast for a version of the routine optimized for 
speed.
</p>
</descr>
<seealso>
<link id="UTF8CodepointSize"/>
<link id="UTF8LengthFast"/>
</seealso>
</element>
<element name="UTF8Length.Result">
<short>Number of codepoints in the byte values for the string.</short>
</element>
<element name="UTF8Length.s">
<short>UTF-8-encoded string to examine in the function.</short>
</element>
<element name="UTF8Length.p">
<short>Pointer to the UTF-8-encoded string to examine in the function.</short>
</element>
<element name="UTF8Length.ByteCount">
<short>Number of byte values in the UTF-8-encoded string.</short>
</element>

<element name="UTF8LengthFast">
<short>
Fast version of UTF8Length.
</short>
<descr>
<p>
<var>UTF8LengthFast</var> is an overloaded <var>PtrInt</var> function used to 
get the length of a UTF-8-encoded string in codepoints. UTF8LengthFast is the 
fast version of <var>UTF8Length</var>. It does not call the UTF8CodepointSize 
function. The UTF-8-encoded string data is assumed to be valid. The native 
data size for the CPU is used to process blocks of UTF-8-encoded data. For a 
64-bit CPU, this means that 8 bytes are read and processed at once.
</p>
<p>
The overloaded variants allow the UTF-8-encoded data to be specified as 
either a String type, or a null-terminated PChar type. Internally, the 
String-based variant casts its data to a PChar type and calls the overloaded 
variant.
</p>
<p>
UTF8LengthFast is a Free Pascal implementation of the C routine provided by 
Colin Percival:
</p>
<p>
<url 
href="https://www.daemonology.net/blog/2008-06-05-faster-utf8-strlen.html">
Even faster UTF-8 character counting
</url>
</p>
</descr>
<seealso>
<link id="UTF8Length"/>
</seealso>
</element>
<element name="UTF8LengthFast.Result">
<short>Number of codepoints in the string.</short>
</element>
<element name="UTF8LengthFast.s">
<short>String with UTF-8-encoded values.</short>
</element>
<element name="UTF8LengthFast.p">
<short>Pointer to the String with UTF-8-encoded values.</short>
</element>
<element name="UTF8LengthFast.ByteCount">
<short>Number of byte values in the UTF-8-encoded string.</short>
</element>

<element name="UTF8CodepointCount">
<short>
Gets the number of valid UTF-8 codepoints in the specified value.
</short>
<descr>
<p>
<var>UTF8CodepointCount</var> is an overloaded <var>SizeInt</var> function used 
to determine the number of UTF-8 codepoints found in the specified value. It is 
similar to the UTF8Length routine, but excludes any invalid codepoints found in 
the input value from the count in the return value. The overloaded variants 
allow the input value to be specified using either the String or the PChar type.
</p>
<p>
UTF8CodepointCount iterates over the byte values in the s or p arguments, and 
increments the return value when a valid UTF-8 codepoint is found. 
UTF8CodepointLen (in system.pp) is called to the get the size for each of the 
UTF-8 codepoints. Valid codepoints include those represented using combining 
characters. The process is repeated until all of the bytes in the input value 
have been examined, or until a codepoint with a length of zero (0) is 
encountered.
</p>
<p>
The return value is zero (0) if the s or p arguments are empty, or when the 
ByteCount argument is zero (0).
</p>
<p>
For example:
</p>
<code>
// var
//   Utf8Str, InvalidUtf8Str: String;
//   Cnt, Len: Integer;

{A macron (decomposed)}
Utf8Str := 'A' + #$CC#$84;

{invalid single byte UTF-8}
InvalidUtf8Str := #$C0#$C1#$F5#$F6#$F7#$F8#$F9#$FA#$FB#$FC#$FD#$FE#$FF;

Cnt := UTF8CodePointCount(Utf8Str); // Cnt = 2
Len := UTF8Length(Utf8Str); // Len = 2

Cnt := UTF8CodePointCount(InvalidUtf8Str); // Cnt = 0
Len := UTF8Length(InvalidUtf8Str); // Len = 13

Cnt := UTF8CodePointCount(InvalidUtf8Str + Utf8Str); // Cnt = 2
Len := UTF8Length(InvalidUtf8Str + Utf8Str); // Len = 15
</code>
</descr>
<version>
Added in LazUtils version 4.0.
</version>
<seealso>
<link id="UTF8Length"/>
<link id="UTF8CodepointSize"/>
<link id="UTF8LengthFast"/>
<link id="UTF8CharacterLength"/>
<link id="#rtl.system.UTF8CodepointLen">UTF8CodepointLen</link>
</seealso>
</element>
<element name="UTF8CodepointCount.Result">
<short>
Integer value with the number of valid codepoints including combining 
characters.
</short>
</element>
<element name="UTF8CodepointCount.s">
<short>
String with the codepoints examined in the routine.
</short>
</element>
<element name="UTF8CodepointCount.p">
<short>
PChar type with the codepoints examined in the routine.
</short>
</element>
<element name="UTF8CodepointCount.ByteCount">
<short>
Number of bytes in the PChar value.
</short>
</element>

<element name="UTF8CodepointToUnicode">
<short>
Converts a UTF-8-encoded character to its unique Unicode U+XXXX character 
value.
</short>
<descr>
<p>
<var>UTF8CodepointToUnicode</var> is a <var>Cardinal</var> function used to 
convert a UTF-8-encoded character to its representation as a unique Unicode 
U+XXXX hexadecimal character value. For example: The letter 'A' (Decimal 65) 
is expressed in Unicode as U+0041.
</p>
<p>
<var>CodepointLen</var> is an output variable used to store the number of 
UTF-8-encoded bytes needed for the codepoint. It will normally contain a 
value in the range 1..4 (the number of possible bytes used in the UTF-8 
encoding scheme). It can contain 0 (zero) when p is an empty PChar value.
</p>
<p>
The return value for the function contains the hexadecimal Unicode character 
value as a Cardinal data type. It can contain 0 (zero) when the value in p is 
not a valid UTF-8-encoded character.
</p>
<p>
Use <var>UTF8FixBroken</var> to fix invalid UTF-8 encoding in the string.
</p>
<p>
Use UnicodeToUTF8 to convert a Unicode character value to its UTF-8-encoded 
value.
</p>
<remark>
UTF8CodepointToUnicode does not check whether the codepoint is actually 
defined in Unicode tables.
</remark>
</descr>
<seealso/>
</element>
<element name="UTF8CodepointToUnicode.Result">
<short>Unicode character value for the UTF-8 character.</short>
</element>
<element name="UTF8CodepointToUnicode.p">
<short>The UTF-8-encode string value.</short>
</element>
<element name="UTF8CodepointToUnicode.CodepointLen">
<short>Number of bytes needed for the codepoint.</short>
</element>

<element name="UTF8CharacterToUnicode">
<short>
Returns the codepoint at p and the number of bytes to skip.
</short>
<descr>
<remark>
Deprecated. Use Use UTF8CodepointToUnicode instead.
</remark>
<p>
If p=nil then CharLen and result are 0 otherwise CharLen&gt;0. If there is an 
encoding error the Result is 0 and CharLen=1 to skip forward. It is safe to 
do:
</p>
<code>
var
  s: string;
  p:=1;
while p &lt;= length(s) do
begin
  UTF8CharacterToUnicode(@s[p], CharLen);
  inc(p, CharLen);
end;
</code>
<p>
For speed reasons, this function only checks for 1, 2, 3, or 4 byte encoding 
errors. It does not check whether the codepoint is defined in the Unicode 
table.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8CharacterToUnicode.Result"/>
<element name="UTF8CharacterToUnicode.p"/>
<element name="UTF8CharacterToUnicode.CharLen"/>

<element name="UnicodeToUTF8">
<short>
Encodes the given code point as an UTF-8 sequence of 1 to 4 bytes.
</short>
<descr>
<p>
<var>UnicodeToUTF8</var> is an <var>Integer</var> function used to convert 
the Unicode character value in CodePoint to the sequence of bytes needed for 
the UTF-8 encoding. UnicodeToUTF8 stores the UTF-8-encoded byte values for 
the Unicode character in the <var>Buf</var> parameter.
</p>
<p>
The return value contains the number of bytes required for the UTF-8-encoded 
value (in the range 1..4). If it contains 0 (zero), the Unicode codepoint was 
invalid and an <var>Exception</var> is raised.
</p>
<remark>
UnicodeToUTF8 does not process #0 byte values for the codepoint, as done for 
UTF-32.
</remark>
</descr>
<errors>
<p>
Raises an <var>Exception</var> when Utf8TryFindCodepointStartCodePoint is an 
invalid Unicode character value. Raised with the message 'UnicodeToUTF8: 
invalid Unicode: XXXXXXXX'.
</p>
</errors>
<seealso/>
</element>
<element name="UnicodeToUTF8.Result">
<short>Number of bytes needed for the UTF-8-encoded value.</short>
</element>
<element name="UnicodeToUTF8.Codepoint">
<short>Unicode character value to convert in the function.</short>
</element>
<element name="UnicodeToUTF8.Buf">
<short>Stores the UTF-8-encoded byte values for the codepoint.</short>
</element>

<element name="UnicodeToUTF8SkipErrors">
<short>
Stores a single Unicode codepoint as a UTF-8-encoded value in the buffer.
</short>
<descr>
<p>
<var>UnicodeToUTF8SkipErrors</var> is a simple and fast function used to 
write a single Unicode codepoint as a UTF-8-encoded value in Buf. It returns 
the number of bytes written. It does not append a terminating null (#0) 
character. It does not check if the codepoint actually exists in Unicode 
tables. It returns 0 if the codepoint can not be represented as a 1 to 4 byte 
UTF-8 sequence.
</p>
</descr>
<seealso/>
</element>
<element name="UnicodeToUTF8SkipErrors.Result">
<short>UTF-8-encoded value for the codepoint.</short>
</element>
<element name="UnicodeToUTF8SkipErrors.Codepoint">
<short>Codepoint (Unicode character) to convert in the function.</short>
</element>
<element name="UnicodeToUTF8SkipErrors.Buf">
<short>Buffer where the converted value is stored.</short>
</element>

<element name="UnicodeToUTF8Inline">
<short>
Encodes the given code point as an UTF-8 sequence of 1 to 4 bytes.
</short>
<descr>
<p>
<var>UnicodeToUTF8Inline</var> is an <var>Integer</var> function used to 
convert the Unicode character value in <var>CodePoint</var> to the sequence 
of bytes needed for the UTF-8 encoding. UnicodeToUTF8Inline stores the 
UTF-8-encoded byte values for the Unicode character in the <var>Buf</var> 
parameter.
</p>
<p>
The return value contains the number of bytes required for the UTF-8-encoded 
value (in the range 1..4).
</p>
<p>
Used in the implementation of <var>UnicodeToUTF8</var> and 
<var>UnicodeToUTF8SkipErrors</var>.
</p>
<remark>
UnicodeToUTF8Inline does not process #0 byte values for the codepoint, as 
done for UTF-32.
</remark>
</descr>
<seealso/>
</element>
<element name="UnicodeToUTF8Inline.Result">
<short>Number of bytes required for the UTF-8-encoded value.</short>
</element>
<element name="UnicodeToUTF8Inline.CodePoint">
<short>Unicode character value to convert.</short>
</element>
<element name="UnicodeToUTF8Inline.Buf">
<short>Destination where encoded byte values are stored.</short>
</element>

<element name="UTF8ToDoubleByteString">
<short>
Converts UTF-8 values to their DBCS equivalent.
</short>
<descr>
<p>
<var>UTF8ToDoubleByteString</var> is a <var>String</var> function used to 
convert UTF-8-encoded values to the representation used in Double Byte 
Character Sets (DBCS).
</p>
<p>
UTF8ToDoubleByteString calls <var>UTF8Length</var> to get the number of 
codepoints (or characters) in s, and calls <var>UTF8ToDoubleByte</var> to 
perform the conversion. Each codepoint is converted to Unicode by calling 
<var>UTF8CodepointToUnicode</var>.
</p>
<p>
The return value is a String type with the byte values from the conversion, 
or an empty string ('') when s does not contain a valid UTF-8-encoded string.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8ToDoubleByteString.Result">
<short>DBCS values for the specified codepoints.</short>
</element>
<element name="UTF8ToDoubleByteString.s">
<short>UTF-8-encoded values to convert in the function.</short>
</element>

<element name="UTF8ToDoubleByte">
<short>
Converts a UTF-8-encode string to its DBCS representation.
</short>
<descr>
<p>
<var>UTF8ToDoubleByte</var> is used to convert UTF-8-encoded values to the 
representation used in Double Byte Character Sets (DBCS). UTF8ToDoubleByte 
calls <var>UTF8CodepointToUnicode</var> to process each of the codepoints in 
<var>UTF8Str</var>.
</p>
<p>
The return value contains the byte values from the conversion.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8ToDoubleByte.Result">
<short>Number of double bytes converted in the function.</short>
</element>
<element name="UTF8ToDoubleByte.UTF8Str">
<short>UTF-8-encoded values to convert in the function.</short>
</element>
<element name="UTF8ToDoubleByte.Len">
<short>Length of the UTF-8-encoded input values.</short>
</element>
<element name="UTF8ToDoubleByte.DBStr">
<short>Storage for the Double Byte values.</short>
</element>

<element name="UTF8FindNearestCharStart">
<short>
Finds the start of the UTF-8 character at the specified position.
</short>
<descr>
<p>
Find the start of the UTF-8 character which contains <var>BytePos</var>. If 
BytePos is not part of a valid UTF-8 Codepoint the function returns BytePos. 
BytePos values starts at position 0.
</p>
<p>
Len is the length in bytes.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8FindNearestCharStart.Result">
<short>Position where the next codepoint begins.</short>
</element>
<element name="UTF8FindNearestCharStart.UTF8Str">
<short>Values to examine in the function.</short>
</element>
<element name="UTF8FindNearestCharStart.Len">
<short>Length of the input values.</short>
</element>
<element name="UTF8FindNearestCharStart.BytePos">
<short>Offset into UTF8Str for the initial byte value.</short>
</element>

<element name="Utf8TryFindCodepointStart">
<short>
Tries to find the start of a valid UTF-8 codepoint in a string.
</short>
<descr>
<p>
<var>Utf8TryFindCodepointStart</var> is a <var>Boolean</var> function which 
tries to find the start of a valid UTF-8 codepoint at the specified position 
in <var>AString</var>.
</p>
<p>
The return value contains <b>True</b> if the bytes at the specified position 
are a valid UTF-8 codepoint (1 - 4 bytes). When the return value is 
<b>True</b>, the value in CurPos is updated to contain the position in 
AString where the UTF-8 codepoint begins. Otherwise, the value in CurPos is 
unchanged. Please note, when CurPos points beyond the end of AString you will 
get a crash!
</p>
<remark>
UTF8CodepointStrictSize will <b>NOT</b> "look" beyond the terminating #0 in a 
PChar, so this is safe with AnsiString values.
</remark>
</descr>
<seealso/>
</element>
<element name="Utf8TryFindCodepointStart.Result">
<short>
True when the bytes at the specified position are a valid UTF-8 codepoint.
</short>
</element>
<element name="Utf8TryFindCodepointStart.AString">
<short>Pointer to the string to examine in the function.</short>
</element>
<element name="Utf8TryFindCodepointStart.CurPos">
<short>
Pointer to the first position in the string examined in the function.
</short>
</element>
<element name="Utf8TryFindCodepointStart.CodepointLen">
<short>Number of bytes in the codepoint, or 0 when invalid.</short>
</element>
<element name="Utf8TryFindCodepointStart.Index">
<short>Initial position in the string examined in the function.</short>
</element>
<element name="Utf8TryFindCodepointStart.CharLen">
<short>Number of bytes required for the UTF-8 codepoint.</short>
</element>

<element name="UTF8CodepointStart">
<short>
Finds the n-th UTF-8 codepoint.
</short>
<descr>
<p>
Finds the n-th UTF-8 codepoint, ignoring BIDI.
</p>
<p>
Len is the length in bytes for the values in UTF8Str. CodepointIndex is the 
position of the desired codepoint (starting at 0), in characters.
</p>
<p>
The return value contains the byte values for the codepoint, or Nil when a 
valid codepoint was not found.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8CodepointStart.Result">
<short>Byte values for the codepoint, or Nil.</short>
</element>
<element name="UTF8CodepointStart.UTF8Str">
<short>Values to examine in the function.</short>
</element>
<element name="UTF8CodepointStart.Len">
<short>Length in bytes for the input values.</short>
</element>
<element name="UTF8CodepointStart.CodepointIndex">
<short>Character position for the desired codepoint (zero-based).</short>
</element>

<element name="UTF8CharStart">
<short>
Deprecated. Use UTF8CodepointStart instead.
</short>
<descr>
<remark>
Deprecated. Use UTF8CodepointStart instead.
</remark>
</descr>
<seealso/>
</element>
<element name="UTF8CharStart.Result"/>
<element name="UTF8CharStart.UTF8Str"/>
<element name="UTF8CharStart.Len"/>
<element name="UTF8CharStart.CharIndex"/>

<element name="UTF8CodepointToByteIndex">
<short>
Finds the byte index of the n-th UTF-8 codepoint.
</short>
<descr>
<p>
<var>UTF8CodepointToByteIndex</var> is a <var>PtrInt</var> function used to 
find the byte index in UTF8Str where the n-th UTF-8 codepoint is located. It 
calls UTF8CodepointStart to get a pointer to the requested codepoint position.
</p>
<p>
The return value contains the difference between the pointer offsets in each 
of the PChar values. The return value is -1 when a codepoint is not found at 
the specified position.
</p>
<p>
UTF8CodepointToByteIndex ignores BIDI mode.
</p>
</descr>
<seealso>
<link id="UTF8CodepointStart"/>
<link id="UTF8CharToByteIndex"/>
</seealso>
</element>
<element name="UTF8CodepointToByteIndex.Result">
<short>
Byte position where the requested UTF-8 codepoint is located, or -1 when a codepoint is not available for the index value.
</short>
</element>
<element name="UTF8CodepointToByteIndex.UTF8Str">
<short>
PChar with the multi-byte UTF-8-encoded values examined in the routine.
</short>
</element>
<element name="UTF8CodepointToByteIndex.Len">
<short>
Length of the PChar value in UTF8Str in bytes.
</short>
</element>
<element name="UTF8CodepointToByteIndex.CodepointIndex">
<short>
Position of the codepoint requested in the routine. This is 1-based, like a character index in String.
</short>
</element>

<element name="UTF8CharToByteIndex">
<short>
Deprecated. Use UTF8CodepointToByteIndex instead.
</short>
<descr>
<remark>
Deprecated. Use UTF8CodepointToByteIndex instead.
</remark>
</descr>
<seealso/>
</element>
<element name="UTF8CharToByteIndex.Result"/>
<element name="UTF8CharToByteIndex.UTF8Str"/>
<element name="UTF8CharToByteIndex.Len"/>
<element name="UTF8CharToByteIndex.CharIndex"/>

<element name="UTF8FixBroken">
<short>
Replaces all invalid UTF-8 characters in a string with the specified character.
</short>
<descr>
<p>
<var>UTF8FixBroken</var> is an overloaded routine used to replace all invalid 
UTF-8 characters in the specified value with a replacement character. The 
overloaded variants allow the UTF-8-encoded content to be specified using 
either a PChar or a String type.
</p>
<p>
<var>ReplaceChar</var> contains the character used to replace any invalid UTF-8 
characters found in the input value. The default value for ReplaceChar is the 
Space character (Hex $20 Decimal 32).
</p>
<p>
The PChar variant examines the specified byte values to determine when an 
invalid UTF-8 codepoint is found. This includes 1, 2, or 3 byte values, those 
that fall outside of the ranges allowed in UTF-8, and common byte sequences 
used to inject XSS vulnerabilities. UTF8FixBroken stops processing at the first 
occurrence of the byte value #0 (Decimal 0). UTF-8 byte sequences updated in 
the routine are stored in the original PChar argument.
</p>
<p>
The String variant converts the input argument to a PChar type and calls 
FindInvalidUTF8Codepoint to locate invalid UTF-8 byte sequences. If invalid 
bytes are found, UniqueString is called to get a new reference-counted String 
for the return value generated by calling the overloaded PChar variant.
</p>
</descr>
<version>
Modified in LazUtils version 4.0 to include the ReplaceChar argument.
</version>
<seealso>
<link id="FindInvalidUTF8Codepoint"/>
<link id="#rtl.system.UniqueString">UniqueString</link>
</seealso>
</element>
<element name="UTF8FixBroken.P">
<short>
PChar with the UTF-8-encoded values examined in the routine.
</short>
</element>
<element name="UTF8FixBroken.S">
<short>
String with the UTF-8-encoded values examined in the routine.
</short>
</element>
<element name="UTF8FixBroken.ReplaceChar">
<short>
Character used to replace invalid codepoints in the input argument. The default 
value for the argument is the Space character (decimal 32 hex $20).
</short>
</element>

<element name="UTF8CodepointStrictSize">
<short>Gets the number of bytes needed for the UTF-8 codepoint.</short>
<descr>
<p>
Gets the number of bytes needed for the UTF-8 codepoint in <var>P</var>. The 
return value contains the number of bytes need for the codepoint (in the 
range 1..4), or 0 (zero) when P is not assigned or the codepoint is invalid.
</p>
<remark>
UTF8CodepointStrictSize stops examining the byte values in P when #0 (Decimal 
0) is encountered.
</remark>
</descr>
<seealso/>
</element>
<element name="UTF8CodepointStrictSize.Result">
<short>Number of bytes needed for the codepoint.</short>
</element>
<element name="UTF8CodepointStrictSize.P">
<short>UTF-8-encoded values to examine.</short>
</element>

<element name="UTF8CharacterStrictLength">
<short>
Returns the length in bytes (1..4) for a valid UTF-8 character. Otherwise 0.
</short>
<descr>
<remark>
Deprecated. Use UTF8CodepointStrictSize instead.
</remark>
</descr>
<seealso/>
</element>
<element name="UTF8CharacterStrictLength.Result"/>
<element name="UTF8CharacterStrictLength.P"/>

<element name="UTF8CStringToUTF8String">
<short>
Copies from a C-style string with UTF-8 encoding to UTF-8 string.
</short>
<descr>
<p>
<var>UTF8CStringToUTF8String</var> is a <var>String</var> function used to 
copy the specified number of characters (codepoints) from a C-style string 
with UTF-8 encoding. The return value is a UTF-encoded string with C-style 
specials characters converted to their common equivalents. The following 
C-style quoted characters are handled in the function:
</p>
<dl>
<dt>\t</dt>
<dd>Converted to a Tab character (Decimal 9)</dd>
<dt>\"</dt>
<dd>Converted to a Double Quote character (Decimal 34)</dd>
<dt>\\</dt>
<dd>Converted to a Reverse Solidus character (Decimal 92)</dd>
<dt>\n</dt>
<dd>Converted to the LineEnding ending for the OS or platform</dd>
</dl>
<p>
The return value is a string which contains the number of codepoints in 
<var>SourceStart</var> specified in <var>SourceLen</var>, or an empty string 
('') when SourceLen is 0 (zero).
</p>
</descr>
<seealso/>
</element>
<element name="UTF8CStringToUTF8String.Result">
<short>UTF-8-encode string with C-style quoting removed.</short>
</element>
<element name="UTF8CStringToUTF8String.SourceStart">
<short>PChar with the UTF-8-encoded C-style string.</short>
</element>
<element name="UTF8CStringToUTF8String.SourceLen">
<short>Number of codepoints to copy in the method.</short>
</element>

<element name="UTF8Pos">
<short>
Returns the character index where the search text starts in the string.
</short>
<descr>
<p>
Returns the character index where <var>SearchForText</var> starts in 
<var>SearchInText</var>. An optional <var>StartPos</var> can be given to 
start searching at a given character index. StartPos starts at 1.
</p>
<p>
Returns 0 if the search text is not found in the string.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8Pos.Result">
<short>Character position where the search text was located.</short>
</element>
<element name="UTF8Pos.SearchForText">
<short>Value to locate in the string.</short>
</element>
<element name="UTF8Pos.SearchInText">
<short>String to search for the specified value.</short>
</element>

<element name="UTF8PosP">
<short>
Returns a pointer to the position where SearchForText starts in SearchInText, 
or Nil when not found.
</short>
<descr/>
<seealso/>
</element>
<element name="UTF8PosP.Result">
<short>
Pointer to the character value where SearchForText was located in 
SearchInText, or Nil when not found.
</short>
</element>
<element name="UTF8PosP.SearchForText">
<short>
Pointer to the character(s) to locate in SearchInText.
</short>
</element>
<element name="UTF8PosP.SearchForTextLen">
<short>
Number of bytes in SearchForText.
</short>
</element>
<element name="UTF8PosP.SearchInText">
<short>
Pointer to the character values examined in the routine.
</short>
</element>
<element name="UTF8PosP.SearchInTextLen">
<short>
Number of bytes in SearchInText.
</short>
</element>

<element name="UTF8Copy">
<short>
Copies the specified number of codepoints from the UTF-8-encoded string 
starting at the specified character index.
</short>
<descr>
<p>
<var>UTF8Copy</var> is a <var>String</var> function used copy to 
UTF-8-encoded values from <var>s</var> starting at the position in 
<var>StartCharIndex</var>. A value in StartCharIndex starts at 1 (one). If a 
value is provided that is less than 1, it is convert to 1 (just like in the 
RTL Copy routine). <var>CharCount</var> specifies the number of multi-byte 
characters (or codepoints) to include in the return value. The return value is 
an empty string ('') when <var>s</var> is not a valid UTF-8-encoded string.
</p>
<p>
UTF8Copy behaves like a substring function.
</p>
<remark>
Modified in LazUtils version 4.0 to ensure that StartCharIndex starts at 1 
(for String-style indexing) and not 0 (for PChar-style indexing). 
</remark>
</descr>
<seealso/>
</element>
<element name="UTF8Copy.Result">
<short>
String with codepoints copied from the specified source.
</short>
</element>
<element name="UTF8Copy.s">
<short>
String with values to copy in the function.
</short>
</element>
<element name="UTF8Copy.StartCharIndex">
<short>
Initial character position for the copy operation. Uses index positions 
starting at 1 (just like the String type).
</short>
</element>
<element name="UTF8Copy.CharCount">
<short>
Number of characters (codepoints) to copy in the function.
</short>
</element>

<element name="UTF8Delete">
<short>
Deletes characters (or codepoints) in a UTF-8-encoded string.
</short>
<descr>
<p>
<var>UTF8Delete</var> is an overloaded procedure used to delete characters 
(or codepoints) in a UTF-8-encoded string starting at a given position.
</p>
<p>
<var>StartCharIndex</var> contains the character position in s where values 
will be removed. <var>StartCharIndex</var> refers to codepoints and not 
individual byte or character values. A single character can be expressed as 
1-4 byte values in UTF-8 encoding. <var>CharCount</var> indicates the number 
of codepoints to remove in the function.
</p>
<p>
The value in <var>s</var> is updated directly in the function.
</p>
<p>
An overloaded variant of the procedure is provided for platforms where the 
Win1252 code page is used. On these platforms, raw byte values values in s 
are converted to the UTF-8 code page prior to performing the delete operation.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8Delete.s">
<short>String with values to delete in the procedure.</short>
</element>
<element name="UTF8Delete.StartCharIndex">
<short>Initial character position where values will be deleted.</short>
</element>
<element name="UTF8Delete.CharCount">
<short>
Number of characters (or codepoints) to remove in the procedure.
</short>
</element>

<element name="UTF8Insert">
<short>
Inserts the specified UTF-8 values into a string at the specified character 
position.
</short>
<descr>
<p>
<var>UTF8Insert</var> inserts the specified values into a string at the 
specified character position. UTF8Insert is an overloaded procedure. The 
variants allow the string arguments to be specified as either String or 
UTF8String types.
</p>
<p>
<var>source</var> is the UTF-8-encoded values inserted in the routine.
</p>
<p>
<var>s</var> is the string where the values from source are inserted at the 
specified character position.
</p>
<p>
The value in <var>StartCharIndex</var> starts at <b>1</b>, and represents the 
n-th codepoint (or character) in the destination string (s) where the values 
are inserted. If StartCharIndex contains a value less than 1, it is converted 
to the value 1 (just like in the RTL Insert routine).
</p>
<p>
UTF8Insert calls UTF8CodepointStart to determine the position in s where the 
codepoint represented by StartCharIndex is located. The RTL Insert routine is 
called to insert the UTF-8-encoded values from source into s at the required 
position. If s is an empty UTF-8 string or the specified character index does 
not exist, the value in source is appended to the value in s.
</p>
<remark>
Modified in LazUtils version 4.0 to ensure that: StartCharIndex starts at 1 
(for String-style indexing) and not 0 (for PChar-style indexing), the value is 
appended when the character index is not found.
</remark>
</descr>
<seealso>
<link id="UTF8CodepointStart"/>
<link id="UTF8Delete"/>
<link id="UTF8Pos"/>
</seealso>
</element>
<element name="UTF8Insert.source">
<short>
String with the values inserted in the routine.
</short>
</element>
<element name="UTF8Insert.s">
<short>
String where the values from source are inserted.
</short>
</element>
<element name="UTF8Insert.StartCharIndex">
<short>
Starting character position (1-based) where the inserted values from source 
are stored in s.
</short>
</element>

<element name="UTF8StringReplace">
<short>
Replaces one or more values in a UTF-8-encoded string which match a given 
pattern.
</short>
<descr>
<p>
<var>UTF8StringReplace</var> is an overloaded <var>String</var> function 
which replaces values in a string matching a given pattern.
</p>
<p>
<var>S</var> is the UTF-8-encoded string to update in the function. 
<var>OldPattern</var> is a pattern with the values to be replaced in S. 
<var>NewPattern</var> is the replacement value for OldPattern in S. 
</p>
<p>
<var>Flags</var> contains <var>TReplaceFlags</var> values and control the 
options enabled in the operation. <var>rfIgnoreCase</var> causes 
case-insensitive comparisons to be used for values in S and OldPattern; both 
values are converted to lowercase copies for the purpose. 
<var>rfReplaceAll</var> causes all occurrences of OldPattern to be replaced 
with NewPattern in S. If the flag is omitted, only the first occurrence of 
OldPattern in S is replaced in the routine.
</p>
<p>
<var>ALanguage</var> is the 2-digit ISO 639-1 Language Code, like 'es' or 
'de', used when converting values to lowercase for case-insensitive search. 
The default value is an empty string ('') and offers maximum speed when the 
language is not significant.
</p>
<p>
<var>Count</var> is an output variable used to return the actual number of 
replacements performed in the function.
</p>
<p>
UTF8StringReplace provides support for UTF-8 codepoints which have different 
sizes (byte counts) for the uppercase and lowercase variants of patterns. It 
ensures that the return value is resized (when needed) to account for 
individual codepoint sizes altered in S due to case conversion.
</p>
<p>
The return value is a UTF-8-encoded string with the updated values from S 
following replacements.
</p>
<p>
No actions are performed in the routine if OldPattern is an empty string ('').
</p>
</descr>
<seealso/>
</element>
<element name="UTF8StringReplace.Result">
<short>UTF-8-encoded values after the replace operation.</short>
</element>
<element name="UTF8StringReplace.S">
<short>Original UTF-8-encoded values to examine.</short>
</element>
<element name="UTF8StringReplace.OldPattern">
<short>Pattern to replace in the function.</short>
</element>
<element name="UTF8StringReplace.NewPattern">
<short>Replacement values for the operation.</short>
</element>
<element name="UTF8StringReplace.Flags">
<short>Replace options enabled in the function.</short>
</element>
<element name="UTF8StringReplace.ALanguage">
<short>Language Code used for locale-specific lowercase conversions.</short>
</element>
<element name="UTF8StringReplace.Count">
<short>Number of times the search pattern was replaced in the string.</short>
</element>

<element name="UTF8LowerCase">
<short>
Converts the specified string to lowercase using Unicode case mapping rules.
</short>
<descr>
<p>
<var>UTF8LowerCase</var> is a <var>String</var> function used to convert the 
UTF-8-encoded value in AInStr to its lowercase equivalent. UTF8LowerCase uses 
Unicode Data defined on on the Unicode.org website at 
ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt. FTP lik removed.
The conversion is performed using the Case Mapping Rules defined
in https://www.ksu.ru/eng/departments/ktk/test/perl/lib/unicode/UCDFF301.html#CaseMappings [dead link renoved].
</p>
<p>
ALanguage indicates the language code to use for the conversion. ALanguage 
should be specified using ISO 639-1 format, which uses 2 characters to 
represent each language. If the language has no code in ISO 639-1, then the 
3-chars code from ISO 639-2 should be used. For example: "tr"for the Turkish 
language locale. Special handling is provided in the function for Turkish 
('tr') and Azeri ('az') language codes. ALanguage can be set to an empty 
string ('') for maximum speed in the conversion.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8LowerCase.Result">
<short>Lowercase values for the specified string.</short>
</element>
<element name="UTF8LowerCase.AInStr">
<short>Values to convert in the function.</short>
</element>
<element name="UTF8LowerCase.ALanguage">
<short>Language code for the operation.</short>
</element>

<element name="UTF8LowerString">
<short>
Converts the specified string to lowercase using Unicode case mapping rules.
</short>
<descr>
<p>
Calls UTF8LowerCase to get the return value for the function.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8LowerString.Result">
<short>Lowercase values for the specified string.</short>
</element>
<element name="UTF8LowerString.S">
<short>String value to convert in the function.</short>
</element>

<element name="UTF8UpperCase">
<short>
Converts the specified string to uppercase using Unicode case mapping rules.
</short>
<descr>
<p>
<var>UTF8UpperCase</var> is a <var>String</var> function used to convert the 
UTF-8-encoded value in AInStr to its uppercase equivalent. UTF8UpperCase uses 
Unicode Data as defined at the Unicode.org website. 
[ftp://ftp.unicode.org/Public/UNIDATA/UnicodeData.txt] FTP link removed.
The conversion is performed using the Case Mapping Rules defined at 
https://www.ksu.ru/eng/departments/ktk/test/perl/lib/unicode/UCDFF301.html#CaseMappings. Dead link removed.
</p>
<p>
ALanguage indicates the language code to use for the conversion. ALanguage 
should be specified using ISO 639-1 format, which uses 2 characters to 
represent each language. If the language has no code in ISO 639-1, then the 
3-chars code from ISO 639-2 should be used. For example: "tr"for the Turkish 
language locale. Special handling is provided in the function for Turkish 
('tr') and Azeri ('az') language codes.ALanguage can be set to an empty 
string ('') for maximum speed in the conversion.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8UpperCase.Result">
<short>Uppercase values for the specified string.</short>
</element>
<element name="UTF8UpperCase.AInStr">
<short>Values to convert in the function.</short>
</element>
<element name="UTF8UpperCase.ALanguage">
<short>Language code for the operation.</short>
</element>

<element name="UTF8UpperString">
<short>
Inline variant of UTF8UpperCase.
</short>
<descr>
Inline variant of UTF8UpperCase.
</descr>
<seealso/>
</element>
<element name="UTF8UpperString.Result">
<short>Uppercase values for the string.</short>
</element>
<element name="UTF8UpperString.s">
<short>Values to convert in the function.</short>
</element>

<element name="UTF8UpperCaseFast">
<short>
Gets the uppercase value for the specified text. Optimized to improve speed for ASCII content in the argument.
</short>
<descr>
<p>
<var>UTF8UpperCaseFast</var> examines the ordinal values for the characters in 
<var>AText</var> to determine how the return value is derived. It is optimized 
for ASCII content (byte values in the range 1..128). It converts individual 
characters in the range ['a'..'z'] by subtracting 32 from their ordinal values.
</p>
<p>
If a non-ASCII byte value is found in AText, the return value is derived by 
calling UTF8UpperCase with the value in AText as an argument.
</p>
</descr>
<version>
Added in LazUtils version 4.0.
</version>
<seealso>
<link id="UTF8UpperCase"/>
<link id="UTF8LowerCaseFast"/>
</seealso>
</element>
<element name="UTF8UpperCaseFast.Result">
<short>
Uppercase value for the specified text.
</short>
</element>
<element name="UTF8UpperCaseFast.AText">
<short>
String with the content examined and converted to its uppercase representation.
</short>
</element>

<element name="UTF8LowerCaseFast">
<short>
Gets the lowercase value for the specified text. Optimized to improve speed for ASCII content in the argument.
</short>
<descr>
<p>
<var>UTF8LowerCaseFast</var> examines the ordinal values for the characters in 
<var>AText</var> to determine how the return value is derived. It is optimized 
for ASCII content (byte values in the range 1..128). It converts individual 
characters in the range ['A'..'Z'] by adding 32 to their ordinal values.
</p>
<p>
If a non-ASCII byte value is found in AText, the return value is derived by 
calling UTF8LowerCase with the value in AText as an argument.
</p>
</descr><version>
Added in LazUtils version 4.0.
</version>
<seealso>
<link id="UTF8LowerCase"/>
<link id="UTF8UpperCase"/>
<link id="UTF8UpperCaseFast"/>
</seealso>
</element>
<element name="UTF8LowerCaseFast.Result">
<short>
Lowercase value for the specified text.
</short>
</element>
<element name="UTF8LowerCaseFast.AText">
<short>
String with the content examined and converted to its lowercase representation.
</short>
</element>

<element name="UTF8SwapCase">
<short>
Provides a simplistic implementation of UTF8UpperCase and UTF8LowerCase.
</short>
<descr>
<p>
<var>UTF8SwapCase</var> provides a "naive" implementation that uses 
<var>UTF8UpperCase</var> and <var>UTF8LowerCase</var>. Performance is 
acceptable for short and reasonably long strings, but it could benefit from 
better performance and lower memory consumption.
</p>
<p>
AInStr contains a UTF-8-encoded string with values to convert it the method. 
Each character in AInStr will have its case "toggled" in the function. In 
other words, an uppercase character is converted to lowercase, and vice versa.
</p>
<p>
ALanguage indicates the language code to use for the conversion. ALanguage 
should be specified using ISO 639-1 format, which uses 2 characters to 
represent each language. If the language has no code in ISO 639-1, then the 
3-character code from ISO 639-2 should be used. For example: "tr"for the 
Turkish language locale. Special handling is provided in the function for 
Turkish ('tr') and Azeri ('az') language codes. ALanguage can be set to an 
empty string ('') for maximum speed in the conversion.
</p>
<p>
No actions are performed in the method when the number of bytes for the 
converted value differs from the number of bytes in the original value. In 
this case, the return value contains the unmodified string in AInStr. The 
return value is an empty string ('') when AInStr is an empty string ('').
</p>
</descr>
<seealso/>
</element>
<element name="UTF8SwapCase.Result">
<short>String with the converted case values.</short>
</element>
<element name="UTF8SwapCase.AInStr">
<short>Original values for the conversion.</short>
</element>
<element name="UTF8SwapCase.ALanguage">
<short>Language code for the locale used in the conversion.</short>
</element>

<element name="UTF8ProperCase">
<short>
Capitalizes the first letter of each word in the string.
</short>
<descr>
<p>
<var>UTF8ProperCase</var> is a <var>String</var> function used to capitalize 
the first letter of each word in the specified string. WordDelims is set 
which contains the system characters used as word boundaries in the string.
</p>
<p>
UTF8ProperCase converts all of the values in AInStr to their lowercase 
equivalents, before converting letters following a word delimiter to 
uppercase.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8ProperCase.Result">
<short>Converting values for the string.</short>
</element>
<element name="UTF8ProperCase.AInStr">
<short>Values to convert in the function.</short>
</element>
<element name="UTF8ProperCase.WordDelims">
<short>Characters used as word delimiters.</short>
</element>

<element name="FindInvalidUTF8Codepoint">
<short>
Finds the position where an invalid UTF-8 codepoint is found in the string.
</short>
<descr>
<p>
<var>FindInvalidUTF8Codepoint</var> is a <var>PtrInt</var> function used to 
find the position where an invalid UTF-8 codepoint is located in the 
specified value. The return value contains <b>-1</b> when none of the values 
in p are invalid, or the zero-based offset into p where the invalid encoding 
was located.
</p>
<p>
<var>StopOnNonUTF8</var> indicates if the function should exit when an 
encoded value is found that is not defined for the UTF-8 encoding, or for 
single byte characters inserted in the middle of a UTF-8 encoding (used in 
XSS attacks).
</p>
</descr>
<seealso/>
</element>
<element name="FindInvalidUTF8Codepoint.Result">
<short>Offset into the string for the error.</short>
</element>
<element name="FindInvalidUTF8Codepoint.p">
<short>Values to examine in the function.</short>
</element>
<element name="FindInvalidUTF8Codepoint.Count">
<short>Length of the input values.</short>
</element>
<element name="FindInvalidUTF8Codepoint.StopOnNonUTF8">
<short>True to exit on an malformed codepoint.</short>
</element>

<element name="FindInvalidUTF8Character">
<short>
Returns -1 if OK, otherwise byte index of invalid UTF-8 codepoint.
</short>
<descr>
<remark>
Deprecated. Use FindInvalidUTF8Codepoint instead.
</remark>
<p>
It always stops on irregular codepoints. For example Codepoint 0 is normally 
encoded as #0, but it can also be encoded as #192#0. Because most software 
does not check this, it can be exploited and is a security risk. If 
StopOnNonUTF8 is <b>False</b> it will ignore undefined codes. For example 
#128. By default it stops on such codes.
</p>
</descr>
<seealso/>
</element>
<element name="FindInvalidUTF8Character.Result"/>
<element name="FindInvalidUTF8Character.p"/>
<element name="FindInvalidUTF8Character.Count"/>
<element name="FindInvalidUTF8Character.StopOnNonASCII"/>

<element name="UTF8StringOfChar">
<short>
Creates a string filled with the specified number of given codepoints.
</short>
<descr>
<p>
<var>UTF8StringOfChar</var> is a function used to create a UTF-8-encoded 
string filled with the specified number of occurrences of the given 
codepoint. <var>AUtf8Char</var> is the UTF-8 codepoint to reproduce in the 
function. No actions are performed if AUtf8Char is an empty string (''), or 
contains a malformed UTF-8 codepoint.
</p>
<p>
The return value is filled with byte values for the codepoint (1 to 4 bytes 
as per the UTF-8 encoding). The process is repeated until the number of 
codepoints in <var>N</var> have been stored in the return value.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8StringOfChar.Result`">
<short>
String with the specified number of occurrence of the codepoint.
</short>
</element>
<element name="UTF8StringOfChar.AUtf8Char">
<short>Codepoint to reproduce in the function.</short>
</element>
<element name="UTF8StringOfChar.N">
<short>Number of occurrences to include in the return value.</short>
</element>

<element name="UTF8AddChar">
<short>
Adds the specified number of UTF-8 codepoints to a string.
</short>
<descr>
<p>
<var>UTF8AddChar</var> is a <var>String</var> function used to add the 
specified number of UTF-8 codepoints to a string. <var>AUtf8Char</var> is the 
UTF-8-encoded codepoint to add to string value in <var>S</var>. <var>N</var> 
indicates the number of times the codepoint should be added to the string.
</p>
<p>
No actions are performed in the function when AUtf8Char is an empty string 
(''), or contains a malformed UTF-8 codepoint.
</p>
<remark>
Values added to the string in S are inserted at the beginning of the string 
(prepended).
</remark>
</descr>
<seealso/>
</element>
<element name="UTF8AddChar.Result">
<short>Updated value for the string.</short>
</element>
<element name="UTF8AddChar.AUtf8Char">
<short>Codepoint to prepend to the string value.</short>
</element>
<element name="UTF8AddChar.S">
<short>Original values for the string.</short>
</element>
<element name="UTF8AddChar.N">
<short>Number of codepoints to prepend to the string.</short>
</element>

<element name="UTF8AddCharR">
<short>
Appends the specified number of UTF-8 codepoints to a string.
</short>
<descr>
<p>
<var>UTF8AddChar</var> is a <var>String</var> function used to append the 
specified number of UTF-8 codepoints to a string. <var>AUtf8Char</var> is the 
UTF-8-encoded codepoint to add to string value in <var>S</var>. <var>N</var> 
indicates the number of times the codepoint should be appended to the string.
</p>
<p>
No actions are performed in the function when AUtf8Char is an empty string 
(''), or contains a malformed UTF-8 codepoint.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8AddCharR.Result">
<short>Updated value for the string.</short>
</element>
<element name="UTF8AddCharR.AUtf8Char">
<short>Codepoint to append to the string value.</short>
</element>
<element name="UTF8AddCharR.S">
<short>Original values for the string.</short>
</element>
<element name="UTF8AddCharR.N">
<short>Number of codepoints to append to the string.</short>
</element>

<element name="UTF8PadLeft">
<short>
Adds the specified number of values in AUtf8Char to the beginning of a string.
</short>
<descr>
<p>
<var>UTF8PadLeft</var> is used to add the specified number of values in 
<var>AUtf8Char</var> to the beginning of a string. The default value for 
AUtf8Char is #32 ([SPACE]), but can contain any valid UTF-8 codepoint (1 to 4 
bytes). UTF8PadLeft calls <var>Utf8AddChar</var> to create the return value 
for the function.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8PadLeft.Result">
<short>
Updated value for the string with characters inserted at the beginning.
</short>
</element>
<element name="UTF8PadLeft.S">
<short>Original string value to modify in the function.</short>
</element>
<element name="UTF8PadLeft.N">
<short>Number of codepoints desired in the modified string.</short>
</element>
<element name="UTF8PadLeft.AUtf8Char">
<short>UTF-8 codepoint to insert into the string.</short>
</element>

<element name="UTF8PadRight">
<short>
Appends the specified number of UTF-8 codepoints to the end of a string.
</short>
<descr>
<p>
<var>UTF8PadRight</var> is used to append the specified number of UTF-8 
codepoints to the end of a string. The default value for <var>AUtf8Char</var> 
is #32 ([SPACE]), but can contain any valid UTF-8 codepoint (1 to 4 bytes). 
UTF8PadRight calls <var>Utf8AddCharR</var> to create the return value for the 
function.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8PadRight.Result">
<short>Updated value for the string.</short>
</element>
<element name="UTF8PadRight.S">
<short>Original string to modify in the function.</short>
</element>
<element name="UTF8PadRight.N">
<short>Number of codepoints desired in the modified string.</short>
</element>
<element name="UTF8PadRight.AUtf8Char">
<short>Codepoint to append to the string value.</short>
</element>

<element name="UTF8PadCenter">
<short>
Center aligns a string to the specified length.
</short>
<descr>
<p>
<var>UTF8PadCenter</var> is used to center align a string to the specified 
length (number of codepoints). <var>N</var> indicates the length of the 
modified string after padding on the left and right with the UTF-8 codepoint 
in <var>AUtf8Char</var>. The default value for AUtf8Char is #32 ([SPACE]), 
but can contains any valid UTF-8 codepoint (1 to 4 bytes).
</p>
</descr>
<seealso/>
</element>
<element name="UTF8PadCenter.Result">
<short>Modified value for the string after center alignment.</short>
</element>
<element name="UTF8PadCenter.S">
<short>Original string value.</short>
</element>
<element name="UTF8PadCenter.N">
<short>Desired length for the string (in codepoints).</short>
</element>
<element name="UTF8PadCenter.AUtf8Char">
<short>UTF-8 codepoint used as a padding character.</short>
</element>

<element name="UTF8LeftStr">
<short>
Gets the specified number of characters (codepoints) at the start of the 
string.
</short>
<descr>
<p>
<var>UTF8LeftStr</var> is used to get the specified number of characters 
(codepoints) at the beginning of the UTF-8-encoded string. UTF8LeftStr calls 
<var>Utf8Copy</var> to get the return value for the function.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8LeftStr.Result">
<short>Values from the specified string.</short>
</element>
<element name="UTF8LeftStr.AText">
<short>Original string to examine in the function.</short>
</element>
<element name="UTF8LeftStr.ACount">
<short>Number of characters (codepoints) to get from the string.</short>
</element>

<element name="UTF8RightStr">
<short>
Gets the specified number of characters (codepoints) at the end of the string.
</short>
<descr>
<p>
<var>UTF8RightStr</var> is used to get the specified number of characters 
(codepoints) at the end of the UTF-8-encoded string. UTF8RightStr calls 
<var>Utf8Copy</var> to get the return value for the function.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8RightStr.Result">
<short>Values from the string.</short>
</element>
<element name="UTF8RightStr.AText">
<short>Original string to examine in the function.</short>
</element>
<element name="UTF8RightStr.ACount">
<short>Number of characters (codepoints) to get from the string.</short>
</element>

<element name="UTF8QuotedStr">
<short>
Performs safe quoting for the specified UTF-8-encoded string value.
</short>
<descr>
<p>
<var>UTF8QuotedStr</var> is a <var>String</var> function used to double all 
occurrences of the byte sequence in the Quote argument. It works like the 
QuotedStr or AnsiQuotedStr routines from the RTL <file>sysutils</file> unit, 
but allows the Quote character to contain a valid multi-byte UTF-8 codepoint. 
Processing in the routine is halted when the #0 (Decimal 0) character is 
encountered.
</p>
<p>
Like its counterparts, UTF8QuotedStr encloses the return value with the 
character specified in the Quote argument.
</p>
</descr>
<seealso>
<link id="#rtl.sysutils.QuotedStr">QuotedStr</link>
<link id="#rtl.sysutils.AnsiQuotedStr">AnsiQuotedStr</link>
</seealso>
</element>
<element name="UTF8QuotedStr.Result">
<short>
Value in S after safe UTF-8 quoting has been applied.
</short>
</element>
<element name="UTF8QuotedStr.S">
<short>
String with the values examined and quoted in the routine.
</short>
</element>
<element name="UTF8QuotedStr.Quote">
<short>
Byte sequence with the quote character used in the routine.
</short>
</element>

<element name="UTF8StartsText">
<short>
Determines if a string starts with the specified value.
</short>
<descr>
<p>
<var>UTF8StartsText</var> determines if the value in <var>AText</var> begins 
with the value in <var>ASubText</var>. Both values can contain a valid 
UTF-8-encoded string. The return value is <b>False</b> when ASubText is an 
empty string (''), or ASubText contains more characters (codepoints) than the 
value in AText.
</p>
<p>
UTF8StartsText calls <var>Utf8Copy</var> and 
<var>UTF8CompareLatinTextFast</var> to perform a case-insensitive comparison 
between the values.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8StartsText.Result">
<short>True when the strings starts with the specified text.</short>
</element>
<element name="UTF8StartsText.ASubText">
<short>Value to locate at the start of the string.</short>
</element>
<element name="UTF8StartsText.AText">
<short>String to examine in the function.</short>
</element>

<element name="UTF8EndsText">
<short>
Determines if a string ends with the specified value.
</short>
<descr>
<p>
<var>UTF8EndsText</var> determines if the value in <var>AText</var> ends with 
the value in <var>ASubText</var>. Both values can contain a valid 
UTF-8-encoded string. The return value is <b>False</b> when ASubText is an 
empty string (''), or ASubText contains more characters (codepoints) than the 
value in AText.
</p>
<p>
UTF8StartsText calls <var>Utf8Copy</var> and 
<var>UTF8CompareLatinTextFast</var> to perform a case-insensitive comparison 
between the values.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8EndsText.Result">
<short>True when the strings ends with the specified text.</short>
</element>
<element name="UTF8EndsText.ASubText">
<short>Value to locate at the end of the string.</short>
</element>
<element name="UTF8EndsText.AText">
<short>String to examine in the function.</short>
</element>

<element name="UTF8ReverseString">
<short>
Reverses the order of codepoints in the specified string.
</short>
<descr>
<p>
<var>UTF8ReverseString</var> is used to create a string with the specified 
content in reverse order. p contains the UTF-8-encoded values for the 
original string.
</p>
<p>
ByteCount indicates the total number of bytes needed to represent the 
codepoints in <var>p</var>.
</p>
<p>
UTF8ReverseString calls <var>UTF8CodepointSize</var> and moves the needed 
number of byte values in p to the return value for the function.
</p>
</descr>
<seealso>
<link id="UTF8CodepointSize"/>
</seealso>
</element>
<element name="UTF8ReverseString.Result">
<short>String with the reversed text values.</short>
</element>
<element name="UTF8ReverseString.p">
<short>PChar type with values reversed in the routine.</short>
</element>
<element name="UTF8ReverseString.ByteCount">
<short>Number of bytes reversed in the routine.</short>
</element>
<element name="UTF8ReverseString.AText">
<short>String with the values reversed in the routine.</short>
</element>

<element name="UTF8RPos">
<short>
Gets the right-most position in the Source string for the value in Substr.
</short>
<descr></descr>
<seealso>
<link id="UTF8Length"/>
</seealso>
</element>
<element name="UTF8RPos.Result">
<short>Pointer to the position in Source.</short>
</element>
<element name="UTF8RPos.Substr">
<short>Value to locate in Source.</short>
</element>
<element name="UTF8RPos.Source">
<short>String with values examined in the routine.</short>
</element>

<element name="UTF8WrapText">
<short>
Creates a word-wrapped version of the specified string.
</short>
<descr>
<p>
<var>UTF8WrapText</var> is an overloaded <var>String</var> function used to 
wrap lines of text in <var>S</var> at the number of characters (codepoints) 
specified in <var>MaxCol</var>.
</p>
<p>
The overloaded variant allow additional parameters to be provided with the 
EOL character sequence and a set of characters where a line break can be 
inserted. Default characters are used in <var>BreakChars</var> for the 
variant without a BreakChars argument. They include: ' ' (Space), '-' (Dash), 
and #9 (Tab). <var>BreakStr</var> contains the end-of-line sequence used to 
represent a line break inserted into the return value.
</p>
<p>
Use <var>Indent</var> to specify the number of Space (#32) characters inserted 
as indentation at the beginning of each word-wrapped line. The default value is 
0 (zero) and omits indentation in the word-wrapped lines. A negative value in 
Indent causes the argument to be set to 0.
</p>
<p>
The Indent argument affects the number of UTF-8 characters allowed in each 
word-wrapped line. When set to a positive non-zero value, the maximum number of 
characters allowed per line is <b>MaxCol - Indent</b>.
</p>
<p>
No actions are performed in the function when S is an empty string (''), 
MaxCol is set to 0 (zero), or BreakChars is an empty set ([]).
</p>
</descr>
<version>
Modified in LazUtils 4.0 to include the overload with an indentation argument.
</version>
<seealso>
<link id="#lazutils.lazstringutils.BreakString">BreakString</link>
</seealso>
</element>
<element name="UTF8WrapText.Result">
<short>Word-wrapped version of the specified text.</short>
</element>
<element name="UTF8WrapText.S">
<short>String with values word-wrapped in the routine.</short>
</element>
<element name="UTF8WrapText.BreakStr">
<short>End-of-line sequence used in the routine.</short>
</element>
<element name="UTF8WrapText.BreakChars">
<short>Set of characters where a line break cab be inserted.</short>
</element>
<element name="UTF8WrapText.MaxCol">
<short>Maximum line width in number of UTF-8 characters.</short>
</element>
<element name="UTF8WrapText.Indent">
<short>
Number of Space (#32) characters used to indent the individual lines of 
word-wrapped text.
</short>
</element>

<element name="IsPureAscii">
<short>
Determines whether the specified string contains only single-byte ASCII  
characters.
</short>
<descr>
<p>
Used in the implementation of the TStringListUTF8Fast.InsertItem method.
</p>
</descr>
<version>
Added in LazUtils version 3.2.
</version>
<seealso>
<link id="TStringListUTF8Fast.InsertItem"/>
</seealso>
</element>
<element name="IsPureAscii.Result">
<short>
Returns <b>True</b> if all of the characters in S have a value less than $7F.
</short>
</element>
<element name="IsPureAscii.S">
<short>
String with the characters examined in the method.
</short>
</element>

<element name="TEscapeMode">
<short>
Represents styles used to escape control characters.
</short>
<descr>
<p>
<var>TEscapeMode</var> is an enumerated type with values that determine the 
output style for escaped characters in <var>Utf8EscapeControlChars</var>.
</p>
</descr>
<seealso/>
</element>
<element name="TEscapeMode.emPascal">
<short>Pascal-style escape characters '#27'</short>
</element>
<element name="TEscapeMode.emHexPascal">
<short>Pascal-style hexadecimal strings '#$1B'</short>
</element>
<element name="TEscapeMode.emHexC">
<short>C-style hexadecimal strings '\0x1B'</short>
</element>
<element name="TEscapeMode.emC">
<short>C-style strings '\e'</short>
</element>
<element name="TEscapeMode.emAsciiControlNames">
<short>ASCII-style control names '[ESC]'</short>
</element>

<element name="Utf8EscapeControlChars">
<short>
Translates control characters in a UTF-8-encoded string into human readable 
format.
</short>
<descr>
<p>
<var>Utf8EscapeControlChars</var> translates control characters inside a 
UTF-8-encoded string into human readable format. Characters in the range 
#0..#31 are converted into the human-readable values for the control 
characters in the format specified by <var>EscapeMode</var>, including:
</p>
<dl>
<dt>emPascal</dt>
<dd>Pascal-style escape characters '#27'</dd>
<dt>emHexPascal</dt>
<dd>Pascal-style hexadecimal strings '#$1B'</dd>
<dt>emHexC</dt>
<dd>C-style hexadecimal strings '\0x1B'</dd>
<dt>emC</dt>
<dd>C-style strings '\e'</dd>
<dt>emAsciiControlNames</dt>
<dd>ASCII-style control names '[ESC]'</dd>
</dl>
<p>
Utf8EscapeControlChars calls <var>FindInvalidUTF8Codepoint</var> to see if 
<var>S</var> contains any invalid codepoints for the UTF-8 encoding. 
<var>UTF8FixBroken</var> is called to repair the input value.
</p>
<p>
Utf8EscapeControlChars iterates over the characters in S, and converts any 
character value in the eligible range using an internal lookup table for the 
value in EscapeMode. All other character values (or values in multi-byte 
UTF-8 code points) are included in the return value in their unmodified form.
</p>
<p>
Mainly used as a diagnostic or logging tool.
</p>
</descr>
<seealso>
<link id="UTF8FixBroken"/>
<link id="TEscapeMode"/>
</seealso>
</element>
<element name="Utf8EscapeControlChars.Result">
<short>String with the escaped values for control characters in S.</short>
</element>
<element name="Utf8EscapeControlChars.S">
<short>UTF-8 encoded string with values converted in the routine.</short>
</element>
<element name="Utf8EscapeControlChars.EscapeMode">
<short>Controls the human readable format for escaped characters.</short>
</element>

<element name="TUTF8TrimFlag">
<short>
Controls trimming actions performed in UTF8Trim.
</short>
<descr>
<p>
<var>TUTF8TrimFlag</var> is an enumerated type with values that control 
trimming actions performed in the <var>UTF8Trim</var> function.
</p>
</descr>
<seealso>
<link id="TUTF8TrimFlags"/>
<link id="UTF8Trim"/>
</seealso>
</element>
<element name="TUTF8TrimFlag.u8tKeepStart">
<short>Keeps leading whitespace.</short>
</element>
<element name="TUTF8TrimFlag.u8tKeepEnd">
<short>Keeps trailing whitespace.</short>
</element>
<element name="TUTF8TrimFlag.u8tKeepTabs">
<short>Keeps tab characters.</short>
</element>
<element name="TUTF8TrimFlag.u8tKeepLineBreaks">
<short>Keeps line breaks.</short>
</element>
<element name="TUTF8TrimFlag.u8tKeepNoBreakSpaces">
<short>Keeps no-break space characters.</short>
</element>
<element name="TUTF8TrimFlag.u8tKeepControlCodes">
<short>Keeps control codes other than tabs and line breaks.</short>
</element>

<element name="TUTF8TrimFlags">
<short>
Stores values from the TUTF8TrimFlag enumeration.
</short>
<descr>
<p>
<var>TUTF8TrimFlags</var> is a set type used to store values from the 
<var>TUTF8TrimFlag</var> enumeration. TUTF8TrimFlags is the type passed in 
arguments to the <var>UTF8Trim</var> function.
</p>
</descr>
<seealso>
<link id="TUTF8TrimFlag"/>
<link id="UTF8Trim"/>
</seealso>
</element>

<element name="UTF8Trim">
<short>
Removes leading and trailing whitespace or control characters.
</short>
<descr>
<p>
<var>UTF8Trim</var> removes spaces, tabs, line breaks and control characters 
at both the start and the end of the UTF-8-encoded value in <var>s</var>. Use 
<var>Flags</var> to delete at the start only or at the end only, or to to not 
delete line breaks. Control characters are the Unicode sets C0 and C1, and 
the left-to-right and right-to-left marks.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8Trim.Result">
<short>Trimmed values for the string.</short>
</element>
<element name="UTF8Trim.s">
<short>String with values to trim.</short>
</element>
<element name="UTF8Trim.Flags">
<short>Actions to perform in the function.</short>
</element>

<element name="UTF8CompareStr">
<short>
Compares the UTF-8-encoded string values.
</short>
<descr>
<p>
<var>UTF8CompareStr</var> is a function used to compare the specified 
UTF-8-encoded string values. The return value indicates the relative sort 
order for the compared values, and includes:
</p>
<dl>
<dt>0</dt>
<dd>Values are the same</dd>
<dt>&lt;1</dt>
<dd>Value S1 comes before S2 in an alphabetic sort order</dd>
<dt>&gt;1</dt>
<dd>Value S1 comes after S2 in an alphabetic sort order</dd>
</dl>
<p>
Internally, UTF8CompareStr calls <var>WideCompareText</var> using the values 
in S1 and S2 converted to UTF-16 code points.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8CompareStr.Result">
<short>Relative order for the compared values.</short>
</element>
<element name="UTF8CompareStr.S1">
<short>First value for the comparison.</short>
</element>
<element name="UTF8CompareStr.S2">
<short>Second value for the comparison.</short>
</element>
<element name="UTF8CompareStr.Count1">
<short>Length of the first value.</short>
</element>
<element name="UTF8CompareStr.Count2">
<short>Length of the second value.</short>
</element>

<element name="UTF8CompareStrP">
<short>Compares the specified PChar values.</short>
<descr>
<p>
Calls UTF8CompareStr to get the return value for the function.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8CompareStrP.Result">
<short>Relative order for the compared values.</short>
</element>
<element name="UTF8CompareStrP.S1">
<short>First PChar value for the comparison.</short>
</element>
<element name="UTF8CompareStrP.S2">
<short>Second PChar value for the comparison.</short>
</element>

<element name="UTF8CompareText">
<short>
Case-insensitive comparison of two UTF-8-encoded values.
</short>
<descr>
<p>
<var>UTF8CompareText</var> is a function used to perform a case-insensitive 
comparison between the specified UTF-8-encoded values. The return value 
indicates the relative sort order for the compared values, and includes:
</p>
<dl>
<dt>0</dt>
<dd>Values are the same</dd>
<dt>&lt; 0</dt>
<dd>Value S1 comes before S2 in an alphabetic sort order</dd>
<dt>&gt; 0</dt>
<dd>Value S1 comes after S2 in an alphabetic sort order</dd>
</dl>
<p>
Internally, UTF8CompareText uses <var>WideCompareText</var> when multi-byte 
codepoints are found in the compared values. This function guarantees proper 
collation on all supported platforms.
</p>
</descr>
<seealso/>
</element>
<element name="UTF8CompareText.Result">
<short>Relative order for the compared values.</short>
</element>
<element name="UTF8CompareText.S1">
<short>First value for the comparison.</short>
</element>
<element name="UTF8CompareText.S2">
<short>Second value for the comparison.</short>
</element>

<element name="UTF8CompareTextP">
<short>
Performs a case-insensitive comparision for the specified UTF-8-encoded PChar 
values.
</short>
<descr>
<p>
Converts values in S1 and S2 to UTF-16 encoding, and calls WideCompareText to 
get the return value for the case-insensitive comparison. The return value 
contains the relative difference between the compared values. For instance:
</p>
<ul>
<li>&lt;0 when S1&lt;S2.</li>
<li>0 when S1=S2.</li>
<li>&gt;0 when S1&gt;S2.</li>
</ul>
</descr>
<seealso/>
</element>
<element name="UTF8CompareTextP.Result">
<short>
Integer result for the case-insensitive comparison.
</short>
</element>
<element name="UTF8CompareTextP.S1">
<short>
PChar with the values used in the comparison.
</short>
</element>
<element name="UTF8CompareTextP.S2">
<short>
PChar with the values used in the comparison.
</short>
</element>

<element name="UTF8CompareLatinTextFast">
<short>
Deprecated. Use UTF8CompareText or AnsiCompareText instead.
</short>
<descr>
<p>
<var>UTF8CompareLatinTextFast</var> is like UTF8CompareText, but does not 
return strict alphabetical order. The order is deterministic and good for 
binary search and similar uses. It avoids the conversions from UTF-8 to UTF-16 
needed to use WideCompareText.
</p>
<p>
UTF8CompareLatinTextFast optimizes the comparison of values using single-byte 
encoding by converting uppercase characters to lowercase characters for the 
comparison. Multi-byte portions (with character values larger than Decimal 
127) are optimized to ignore leading bytes sequences common to both compared 
values.
</p>
<p>
Otherwise, the routine falls back to AnsiCompareText to compare lowercase 
ASCII values in S1 and S2.
</p>
<p>
The return value is a pointer to an Integer where the relative sort order for 
the compared values is stored.
</p>
<dl>
<dt>&lt;0</dt>
<dd>S1 comes before S2 in the sort order.</dd>
<dt>&gt;0</dt>
<dd>S1 comes after S2 in the sort order.</dd>
<dt>0 (zero)</dt>
<dd>S1 and S2 have the same value in the sort order.</dd>
</dl>
</descr>
<version>
Deprecated in LazUtils version 3.2 (Feb 2024).
</version>
<seealso>
<link id="UTF8CompareText"/>
<link id="#rtl.sysutils.AnsiCompareText">AnsiCompareText</link>
</seealso>
</element>
<element name="UTF8CompareLatinTextFast.Result">
<short>
Pointer to an Integer with the relative order for the compared values.
</short>
</element>
<element name="UTF8CompareLatinTextFast.S1">
<short>
UTF-8-encoded String value used in the comparison.
</short>
</element>
<element name="UTF8CompareLatinTextFast.S2">
<short>
UTF-8-encoded String value used in the comparison.
</short>
</element>

<element name="UTF8CompareStrCollated">
<short>
Deprecated. Use UTF8CompareStr instead.
</short>
<descr>
<p>
<var>UTF8CompareStrCollated</var> is used to compare two strings using 
language-specific sorting. The return value contains the relative sort order 
for the compared values, as defined for <var>UTF8CompareStr</var>.
</p>
</descr>
<version>
Deprecated in LazUtils version 3.2 (Feb 2024).
</version>
<seealso/>
</element>
<element name="UTF8CompareStrCollated.Result">
<short>Relative order for the compared values.</short>
</element>
<element name="UTF8CompareStrCollated.S1">
<short>First string for the comparison.</short>
</element>
<element name="UTF8CompareStrCollated.S2">
<short>Second string for the comparison.</short>
</element>

<element name="CompareStrListUTF8LowerCase">
<short>
Compares the specified lines of text in a TStringList.
</short>
<descr>
<p>
<var>CompareStrListUTF8LowerCase</var> is an <var>Integer</var> function used 
to compare the specified lines of text in the <var>TStringList</var> 
argument. <var>Index1</var> and <var>Index2</var> contain the ordinal 
positions for the respective lines of text. CompareStrListUTF8LowerCase calls 
<var>UTF8CompareText</var> to perform a case-insensitive comparison between 
the values.
</p>
<p>
The return value contains the relative sort order for the compared values, as 
defined for <var>UTF8CompareText</var>.
</p>
</descr>
<seealso>
<link id="UTF8CompareText"/>
</seealso>
</element>
<element name="CompareStrListUTF8LowerCase.Result">
<short>Relative order for the compared values.</short>
</element>
<element name="CompareStrListUTF8LowerCase.List">
<short>TStringList with values for the comparison.</short>
</element>
<element name="CompareStrListUTF8LowerCase.Index1">
<short>Position of the first text line.</short>
</element>
<element name="CompareStrListUTF8LowerCase.Index2">
<short>Position of the second text line.</short>
</element>

<element name="TStringListUTF8Fast">
<short>
Implements a string list using fast ASCII comparison functions when its data is 
pure ASCII.
</short>
<descr>
<p>
When data is Unicode, it switches to slower AnsiCompare functions. The switch 
is managed by setting the UseLocale property/option and should not be changed 
by the user.
</p>
</descr>
<seealso>
<link id="#rtl.classes.TStringList">TStringList</link>
</seealso>
</element>

<element name="TStringListUTF8Fast.InsertItem">
<short>
Ensures that the UseLocale property is enabled when a new line with non-ASCII 
data is stored in the string list.
</short>
<descr/>
<seealso/>
</element>
<element name="TStringListUTF8Fast.InsertItem.Index">
<short>
Ordinal position in the string list where the value in S is stored.
</short>
</element>
<element name="TStringListUTF8Fast.InsertItem.S">
<short>
String value examined and stored in the method.
</short>
</element>

<element name="TStringListUTF8Fast.Create">
<short>
Constructor for the class instance.
</short>
<descr>
<p>
<var>Create</var> is the overridden constructor for the class instance. It 
calls the inherited method on entry to set the default encoding and options 
used in the class instance. Create ensures that the UseLocale property is set 
to <b>False</b> to allow fast comparisons for ASCII data stored in the string 
list.
</p>
</descr>
<seealso>
<link id="TStringListUTF8Fast.InsertItem"/>
<link id="#rtl.classes.TStrings.UseLocale">TStrings.UseLocale</link>
<link id="#rtl.classes.TStrings.DefaultEncoding">TStrings.DefaultEncoding</link>
</seealso>
</element>

<element name="TConvertResult">
<short>
Indicates the result from UTF-8 &lt;-&gt; UTF-16 conversions.
</short>
<descr>
<p>
<var>TConvertResult</var> is an enumeration type with values that indicate 
the result from <var>ConvertUTF8ToUTF16</var> and 
<var>ConvertUTF16ToUTF8</var> function calls.
</p>
</descr>
<seealso/>
</element>
<element name="TConvertResult.trNoError">
<short>No error in the conversion.</short>
</element>
<element name="TConvertResult.trNullSrc">
<short>Source value is null.</short>
</element>
<element name="TConvertResult.trNullDest">
<short>Destination value is null.</short>
</element>
<element name="TConvertResult.trDestExhausted">
<short>Destination value is too small for the converted value.</short>
</element>
<element name="TConvertResult.trInvalidChar">
<short>An invalid encoding was found in the source value.</short>
</element>
<element name="TConvertResult.trUnfinishedChar">
<short>An unfinished encoding was found in the source value.</short>
</element>

<element name="TConvertOption">
<short>
Indicates options enabled during UTF-8 &lt;-&gt; UTF-16 conversions.
</short>
<descr>
<p>
<var>TConvertOption</var> is an enumeration type with values that indicate 
options enabled during UTF-8 &lt;-&gt; UTF-16 conversions.
</p>
</descr>
<seealso/>
</element>
<element name="TConvertOption.toInvalidCharError">
<short>Stop on invalid source char and report error.</short>
</element>
<element name="TConvertOption.toInvalidCharToSymbol">
<short>Replace invalid source chars with '?'</short>
</element>
<element name="TConvertOption.toUnfinishedCharError">
<short>Stop on unfinished source char and report error.</short>
</element>
<element name="TConvertOption.toUnfinishedCharToSymbol">
<short>Replace unfinished source char with '?'</short>
</element>

<element name="TConvertOptions">
<short>
Stores values from the TConvertOption enumeration.
</short>
<descr>
<p>
Stores values from the <var>TConvertOption</var> enumeration. Passed as an 
argument to <var>ConvertUTF8ToUTF16</var> and <var>ConvertUTF16ToUTF8</var>.
</p>
</descr>
<seealso>
<link id="TConvertOption"/>
<link id="ConvertUTF8ToUTF16"/>
<link id="ConvertUTF16ToUTF8"/>
</seealso>
</element>

<element name="ConvertUTF8ToUTF16">
<short>
Converts values from UTF-8 encoding to UTF-16 encoding.
</short>
<descr>
<p>
<var>ConvertUTF8ToUTF16</var> is used to convert the specified UTF-8 encoded 
string to UTF-16 encoded (system endian).
</p>
<p>
<var>Options</var> indicates the conversion options enabled in the function, 
and can include the following values:
</p>
<dl>
<dt>toInvalidCharError</dt>
<dd>
Stop on invalid source char and report error
</dd>
<dt>toInvalidCharToSymbol</dt>
<dd>
Replace invalid source chars with '?'
</dd>
<dt>toUnfinishedCharError</dt>
<dd>
Stop on unfinished source char and report error
</dd>
<dt>toUnfinishedCharToSymbol</dt>
<dd>
Replace unfinished source char with '?'
</dd>
</dl>
<p>
The return value is a value from the <var>TConvertResult</var> enumeration, 
including:
</p>
<dl>
<dt>
trNoError
</dt>
<dd>
The string was successfully converted without any error
</dd>
<dt>
trNullSrc
</dt>
<dd>
Pointer to source string is nil
</dd>
<dt>
trNullDest
</dt>
<dd>
Pointer to destination string is nil
</dd>
<dt>
trDestExhausted
</dt>
<dd>
Destination buffer size is not big enough to hold converted string
</dd>
<dt>
trInvalidChar
</dt>
<dd>
Invalid source char has occurred
</dd>
<dt>
trUnfinishedChar
</dt>
<dd>
Unfinished source char has occurred
</dd>
</dl>
</descr>
<seealso/>
</element>
<element name="ConvertUTF8ToUTF16.Result">
<short>Converted values from the function.</short>
</element>
<element name="ConvertUTF8ToUTF16.Dest">
<short>Pointer to destination string.</short>
</element>
<element name="ConvertUTF8ToUTF16.DestWideCharCount">
<short>Wide char count allocated in destination string.</short>
</element>
<element name="ConvertUTF8ToUTF16.Src">
<short>Pointer to source string.</short>
</element>
<element name="ConvertUTF8ToUTF16.SrcCharCount">
<short>Char count allocated in source string.</short>
</element>
<element name="ConvertUTF8ToUTF16.Options">
<short>
Conversion options, if none is set, both invalid and unfinished source chars 
are skipped.
</short>
</element>
<element name="ConvertUTF8ToUTF16.ActualWideCharCount">
<short>Actual WideChar count used int he conversion.</short>
</element>

<element name="ConvertUTF16ToUTF8">
<short>Converts values from UTF-16 encoding to UTF-8 encoding.</short>
<descr>
<p>
Converts the specified UTF-16 encoded string (system endian) to its UTF-8 
encoding.
</p>
<p>
<var>Options</var> indicates the conversion options enabled in the function, 
and can include the following values:
</p>
<dl>
<dt>toInvalidCharError</dt>
<dd>
Stop on invalid source char and report error
</dd>
<dt>toInvalidCharToSymbol</dt>
<dd>
Replace invalid source chars with '?'
</dd>
<dt>toUnfinishedCharError</dt>
<dd>
Stop on unfinished source char and report error
</dd>
<dt>toUnfinishedCharToSymbol</dt>
<dd>
Replace unfinished source char with '?'
</dd>
</dl>
<p>
The return value is a value from the <var>TConvertResult</var> enumeration, 
including:
</p>
<dl>
<dt>
trNoError
</dt>
<dd>
The string was successfully converted without any error
</dd>
<dt>
trNullSrc
</dt>
<dd>
Pointer to source string is nil
</dd>
<dt>
trNullDest
</dt>
<dd>
Pointer to destination string is nil
</dd>
<dt>
trDestExhausted
</dt>
<dd>
Destination buffer size is not big enough to hold converted string
</dd>
<dt>
trInvalidChar
</dt>
<dd>
Invalid source char has occurred
</dd>
<dt>
trUnfinishedChar
</dt>
<dd>
Unfinished source char has occurred
</dd>
</dl>
</descr>
<seealso>
<link id="TConvertOptions"/>
<link id="TConvertOption"/>
<link id="TConvertResult"/>
</seealso>
</element>
<element name="ConvertUTF16ToUTF8.Result">
<short>Converted values from the function.</short>
</element>
<element name="ConvertUTF16ToUTF8.Dest">
<short>Pointer to destination string.</short>
</element>
<element name="ConvertUTF16ToUTF8.DestCharCount">
<short>Char count allocated in destination string.</short>
</element>
<element name="ConvertUTF16ToUTF8.Src">
<short>Pointer to source string.</short>
</element>
<element name="ConvertUTF16ToUTF8.SrcWideCharCount">
<short>Wide char count allocated in source string.</short>
</element>
<element name="ConvertUTF16ToUTF8.Options">
<short>Conversion options, if none is set, both
invalid and unfinished source chars are skipped.</short>
</element>
<element name="ConvertUTF16ToUTF8.ActualCharCount">
<short>
Actual char count converted from source string to destination string.
</short>
</element>

<element name="UTF8ToUTF16">
<short>
Converts the UTF-8 encoded string to UTF-16 encoding (system endian).
</short>
<descr>
<p>
Converts the UTF-8 encoded string to UTF-16 encoding (system endian).
</p>
</descr>
<seealso/>
</element>

<element name="UTF16ToUTF8">
<short>
Converts a UTF-16-encoded string (system endian) to UTF-8 encoding.
</short>
<descr>
<p>
UTF16ToUTF8 is a TConvertResult function used to convert the specified 
UTF-16-encoded string (system endian) to UTF-8 encoding.
</p>
<p>
The return value is a <var>TConvertResult</var> enumeration value, and 
includes:
</p>
<dl>
<dt>
trNoError
</dt>
<dd>
The string was successfully converted without any error
</dd>
<dt>
trNullSrc
</dt>
<dd>
Pointer to source string is Nil
</dd>
<dt>
trNullDest
</dt>
<dd>
Pointer to destination string is Nil
</dd>
<dt>
trDestExhausted
</dt>
<dd>
Destination buffer size is not big enough to hold converted string
</dd>
<dt>
trInvalidChar
</dt>
<dd>
Invalid source char has occurred
</dd>
<dt>
trUnfinishedChar
</dt>
<dd>
Unfinished source char has occurred
</dd>
</dl>
</descr>
<seealso>
<link id="TConvertResult"/>
</seealso>
</element>
<element name="UTF16ToUTF8.Result">
<short>UTF-8-encoded string.</short>
</element>
<element name="UTF16ToUTF8.S">
<short>Source UTF-16 string (system endian).</short>
</element>
<element name="UTF16ToUTF8.P">
<short>Pointer to the Source UTF-16 string (system endian).</short>
</element>
<element name="UTF16ToUTF8.WideCnt">
<short>Number of WideChar values in the source string.</short>
</element>

<element name="LazGetLanguageIDs">
<short>
Deprecated. Use the GetLanguageID function from the 
<file>translations.pas</file> unit instead.
</short>
<descr/>
<version>
Deprecated in LazUtils version 2.3.0.
</version>
<seealso>
<link id="#lazutils.translations.GetLanguageID"/>
</seealso>
</element>
<element name="LazGetLanguageIDs.Lang"/>
<element name="LazGetLanguageIDs.FallbackLang"/>

<element name="LazGetShortLanguageID">
<short>
Deprecated. Use the GetLanguageID function from the 
<file>translations.pas</file> unit instead.
</short>
<descr/>
<version>
Deprecated in LazUtils version 2.3.0.
</version>
<seealso>
<link id="#lazutils.translations.GetLanguageID"/>
</seealso>
</element>
<element name="LazGetShortLanguageID.Lang"/>

<element name="FPUpChars">
<short>
Contains uppercase characters for all values in the char type.
</short>
<descr>
<p>
<var>FPUpChars</var> is an array of char type and uses the Lower and Upper 
bounds permitted for the char type. Values in FPUpChars are assigned in the 
initialization section for the <file>lazutf8.pas</file> unit, and contains 
the uppercase equivalent for all characters in the char type.
</p>
</descr>
<seealso/>
</element>

<element name="UTF8GetStandardCodePage">
<short>Gets the default system code page for the wide string manager.</short>
<descr>
<p>
<var>UTF8GetStandardCodePage</var> is a <var>TSystemCodePage</var> function 
used to get the default code page for strings in the Wide String manager. 
UTF8GetStandardCodePage is implemented for Windows platforms that use a 
UTF-8-enabled Run-time Library (RTL). It is assigned as the procedure used by 
the wide string manager for the platform.
</p>
<p>
<var>stdcp</var> contains the <var>TStandardCodePageEnum</var> enumeration 
value that identifies the default code page for the platform.
</p>
<p>
The return value is set to the <var>CP_UTF8</var> constant.
</p>
</descr>
<seealso/>
</element>

</module>
<!-- LazUTF8 -->
</package>
</fpdoc-descriptions>