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 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060 6061 6062 6063 6064 6065 6066 6067 6068 6069 6070 6071 6072 6073 6074 6075 6076 6077 6078 6079 6080 6081 6082 6083 6084 6085 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098
|
<html lang="en">
<head>
<title>GNU Libidn</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="GNU Libidn">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="top" href="#Top">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This manual is last updated 28 May 2009 for version
1.15 of GNU Libidn.
Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Simon Josefsson.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License,
Version 1.3 or any later version published by the Free Software
Foundation; with no Invariant Sections, no Front-Cover Texts, and
no Back-Cover Texts. A copy of the license is included in the
section entitled "GNU Free Documentation License".
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
body {
margin: 2%;
padding: 0 5%;
background: #ffffff;
}
h1,h2,h3,h4,h5 {
font-weight: bold;
padding: 5px 5px 5px 5px;
background-color: #c2e0ff;
color: #336699;
}
h1 {
padding: 2em 2em 2em 5%;
color: white;
background: #336699;
text-align: center;
letter-spacing: 3px;
}
h2 { text-decoration: underline; }
pre {
margin: 0 5%;
padding: 0.5em;
}
pre.example {
border: solid 1px;
background: #eeeeff;
padding-bottom: 1em;
}
pre.verbatim {
border: solid 1px gray;
background: white;
padding-bottom: 1em;
}
div.node {
margin: 0 -5% 0 -2%;
padding: 0.5em 0.5em;
margin-top: 0.5em;
margin-bottom: 0.5em;
font-weight: bold;
}
dd, li {
padding-top: 0.1em;
padding-bottom: 0.1em;
}
--></style>
</head>
<body>
<h1 class="settitle">GNU Libidn</h1>
<div class="contents">
<h2>Table of Contents</h2>
<ul>
<li><a name="toc_Top" href="#Top">GNU Libidn</a>
<li><a name="toc_Introduction" href="#Introduction">1 Introduction</a>
<ul>
<li><a href="#Getting-Started">1.1 Getting Started</a>
<li><a href="#Features">1.2 Features</a>
<li><a href="#Library-Overview">1.3 Library Overview</a>
<li><a href="#Supported-Platforms">1.4 Supported Platforms</a>
<li><a href="#Getting-help">1.5 Getting help</a>
<li><a href="#Commercial-Support">1.6 Commercial Support</a>
<li><a href="#Downloading-and-Installing">1.7 Downloading and Installing</a>
<ul>
<li><a href="#Installing-under-Windows">1.7.1 Installing under Windows</a>
</li></ul>
<li><a href="#Bug-Reports">1.8 Bug Reports</a>
<li><a href="#Contributing">1.9 Contributing</a>
</li></ul>
<li><a name="toc_Preparation" href="#Preparation">2 Preparation</a>
<ul>
<li><a href="#Header">2.1 Header</a>
<li><a href="#Initialization">2.2 Initialization</a>
<li><a href="#Version-Check">2.3 Version Check</a>
<li><a href="#Building-the-source">2.4 Building the source</a>
<li><a href="#Autoconf-tests">2.5 Autoconf tests</a>
<li><a href="#Memory-handling-under-Windows">2.6 Memory handling under Windows</a>
<li><a href="#Memory-handling-under-Windows">2.7 Header file <code>idn-free.h</code></a>
<li><a href="#Memory-handling-under-Windows">2.8 Memory de-allocation function</a>
</li></ul>
<li><a name="toc_Utility-Functions" href="#Utility-Functions">3 Utility Functions</a>
<ul>
<li><a href="#Utility-Functions">3.1 Header file <code>stringprep.h</code></a>
<li><a href="#Utility-Functions">3.2 Unicode Encoding Transformation</a>
<li><a href="#Utility-Functions">3.3 Unicode Normalization</a>
<li><a href="#Utility-Functions">3.4 Character Set Conversion</a>
</li></ul>
<li><a name="toc_Stringprep-Functions" href="#Stringprep-Functions">4 Stringprep Functions</a>
<ul>
<li><a href="#Stringprep-Functions">4.1 Header file <code>stringprep.h</code></a>
<li><a href="#Stringprep-Functions">4.2 Defining A Stringprep Profile</a>
<li><a href="#Stringprep-Functions">4.3 Control Flags</a>
<li><a href="#Stringprep-Functions">4.4 Core Functions</a>
<li><a href="#Stringprep-Functions">4.5 Error Handling</a>
<li><a href="#Stringprep-Functions">4.6 Stringprep Profile Macros</a>
</li></ul>
<li><a name="toc_Punycode-Functions" href="#Punycode-Functions">5 Punycode Functions</a>
<ul>
<li><a href="#Punycode-Functions">5.1 Header file <code>punycode.h</code></a>
<li><a href="#Punycode-Functions">5.2 Unicode Code Point Data Type</a>
<li><a href="#Punycode-Functions">5.3 Core Functions</a>
<li><a href="#Punycode-Functions">5.4 Error Handling</a>
</li></ul>
<li><a name="toc_IDNA-Functions" href="#IDNA-Functions">6 IDNA Functions</a>
<ul>
<li><a href="#IDNA-Functions">6.1 Header file <code>idna.h</code></a>
<li><a href="#IDNA-Functions">6.2 Control Flags</a>
<li><a href="#IDNA-Functions">6.3 Prefix String</a>
<li><a href="#IDNA-Functions">6.4 Core Functions</a>
<li><a href="#IDNA-Functions">6.5 Simplified ToASCII Interface</a>
<li><a href="#IDNA-Functions">6.6 Simplified ToUnicode Interface</a>
<li><a href="#IDNA-Functions">6.7 Error Handling</a>
</li></ul>
<li><a name="toc_TLD-Functions" href="#TLD-Functions">7 TLD Functions</a>
<ul>
<li><a href="#TLD-Functions">7.1 Header file <code>tld.h</code></a>
<li><a href="#TLD-Functions">7.2 Core Functions</a>
<li><a href="#TLD-Functions">7.3 Utility Functions</a>
<li><a href="#TLD-Functions">7.4 High-Level Wrapper Functions</a>
<li><a href="#TLD-Functions">7.5 Error Handling</a>
</li></ul>
<li><a name="toc_PR29-Functions" href="#PR29-Functions">8 PR29 Functions</a>
<ul>
<li><a href="#PR29-Functions">8.1 Header file <code>pr29.h</code></a>
<li><a href="#PR29-Functions">8.2 Core Functions</a>
<li><a href="#PR29-Functions">8.3 Utility Functions</a>
<li><a href="#PR29-Functions">8.4 Error Handling</a>
</li></ul>
<li><a name="toc_Examples" href="#Examples">9 Examples</a>
<ul>
<li><a href="#Example-1">9.1 Example 1</a>
<li><a href="#Example-2">9.2 Example 2</a>
<li><a href="#Example-3">9.3 Example 3</a>
<li><a href="#Example-4">9.4 Example 4</a>
<li><a href="#Example-5">9.5 Example 5</a>
</li></ul>
<li><a name="toc_Invoking-idn" href="#Invoking-idn">10 Invoking idn</a>
<ul>
<li><a href="#Invoking-idn">10.1 Name</a>
<li><a href="#Invoking-idn">10.2 Description</a>
<li><a href="#Invoking-idn">10.3 Options</a>
<li><a href="#Invoking-idn">10.4 Environment Variables</a>
<li><a href="#Invoking-idn">10.5 Examples</a>
<li><a href="#Invoking-idn">10.6 Troubleshooting</a>
</li></ul>
<li><a name="toc_Emacs-API" href="#Emacs-API">11 Emacs API</a>
<ul>
<li><a href="#Emacs-API">11.1 Punycode Emacs API</a>
<li><a href="#Emacs-API">11.2 IDNA Emacs API</a>
</li></ul>
<li><a name="toc_Java-API" href="#Java-API">12 Java API</a>
<ul>
<li><a href="#Java-API">12.1 Overview</a>
<li><a href="#Java-API">12.2 Miscellaneous Programs</a>
<ul>
<li><a href="#Java-API">12.2.1 GenerateRFC3454</a>
<li><a href="#Java-API">12.2.2 GenerateNFKC</a>
<li><a href="#Java-API">12.2.3 TestIDNA</a>
<li><a href="#Java-API">12.2.4 TestNFKC</a>
</li></ul>
<li><a href="#Java-API">12.3 Possible Problems</a>
<li><a href="#Java-API">12.4 A Note on Java and Unicode</a>
</li></ul>
<li><a name="toc_C_0023-API" href="#C_0023-API">13 C# API</a>
<li><a name="toc_Acknowledgements" href="#Acknowledgements">14 Acknowledgements</a>
<li><a name="toc_History" href="#History">15 History</a>
<li><a name="toc_PR29-discussion" href="#PR29-discussion">Appendix A PR29 discussion</a>
<li><a name="toc_On-Label-Separators" href="#On-Label-Separators">Appendix B On Label Separators</a>
<ul>
<li><a href="#On-Label-Separators">B.1 Recommended Workaround</a>
</li></ul>
<li><a name="toc_Copying-Information" href="#Copying-Information">Appendix C Copying Information</a>
<ul>
<li><a href="#GNU-Free-Documentation-License">C.1 GNU Free Documentation License</a>
<li><a href="#GNU-LGPL">C.2 GNU Lesser General Public License</a>
<li><a href="#GNU-GPL">C.3 GNU General Public License</a>
</li></ul>
<li><a name="toc_Function-and-Variable-Index" href="#Function-and-Variable-Index">Function and Variable Index</a>
<li><a name="toc_Concept-Index" href="#Concept-Index">Concept Index</a>
</li></ul>
</div>
<div class="node">
<a name="Top"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Introduction">Introduction</a>,
Up: <a rel="up" accesskey="u" href="#dir">(dir)</a>
</div>
<h2 class="unnumbered">GNU Libidn</h2>
<p>This manual is last updated 28 May 2009 for version
1.15 of GNU Libidn.
<p>Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Simon Josefsson.
<blockquote>
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled “GNU Free
Documentation License”.
</blockquote>
<ul class="menu">
<li><a accesskey="1" href="#Introduction">Introduction</a>: How to use this manual.
<li><a accesskey="2" href="#Preparation">Preparation</a>: What you should do before using the library.
<li><a accesskey="3" href="#Utility-Functions">Utility Functions</a>: Unicode transformation utility functions.
<li><a accesskey="4" href="#Stringprep-Functions">Stringprep Functions</a>: Stringprep functions.
<li><a accesskey="5" href="#Punycode-Functions">Punycode Functions</a>: Punycode functions.
<li><a accesskey="6" href="#IDNA-Functions">IDNA Functions</a>: IDNA functions.
<li><a accesskey="7" href="#TLD-Functions">TLD Functions</a>: TLD functions.
<li><a accesskey="8" href="#PR29-Functions">PR29 Functions</a>: Detect strings non-idempotent under NFKC.
<li><a accesskey="9" href="#Examples">Examples</a>: Demonstrate how to use the library.
<li><a href="#Invoking-idn">Invoking idn</a>: Command line interface to the library.
<li><a href="#Emacs-API">Emacs API</a>: Emacs Lisp API for Libidn.
<li><a href="#Java-API">Java API</a>: Notes on the Java port of Libidn.
<li><a href="#C_0023-API">C# API</a>: Notes on the C# port of Libidn.
<li><a href="#Acknowledgements">Acknowledgements</a>: Whom to blame.
<li><a href="#History">History</a>: Rough outline of development history.
</li></ul>
<p>Appendices
</p>
<ul class="menu">
<li><a href="#PR29-discussion">PR29 discussion</a>: Implementation aspects of the PR29 flaw.
<li><a href="#On-Label-Separators">On Label Separators</a>: Discussions of a flaw in the IDNA spec.
<li><a href="#Copying-Information">Copying Information</a>: License text covering the Libidn library.
</li></ul>
<p>Indices
</p>
<ul class="menu">
<li><a href="#Function-and-Variable-Index">Function and Variable Index</a>
<li><a href="#Concept-Index">Concept Index</a>
</ul>
<div class="node">
<a name="Introduction"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Preparation">Preparation</a>,
Previous: <a rel="previous" accesskey="p" href="#Top">Top</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">1 Introduction</h2>
<p>GNU Libidn is a fully documented implementation of the Stringprep,
Punycode and IDNA specifications. Libidn's purpose is to encode and
decode internationalized domain names. The native C, C# and Java
libraries are available under the GNU Lesser General Public License
version 2.1 or later (see <a href="#GNU-LGPL">GNU LGPL</a>).
<p>The library contains a generic Stringprep implementation. Profiles
for Nameprep, iSCSI, SASL, XMPP and Kerberos V5 are included.
Punycode and ASCII Compatible Encoding (ACE) via IDNA are supported.
A mechanism to define Top-Level Domain (TLD) specific validation
tables, and to compare strings against those tables, is included.
Default tables for some TLDs are also included.
<p>The Stringprep API consists of two main functions, one for converting
data from the system's native representation into UTF-8, and one
function to perform the Stringprep processing. Adding a new
Stringprep profile for your application within the API is
straightforward. The Punycode API consists of one encoding function
and one decoding function. The IDNA API consists of the ToASCII and
ToUnicode functions, as well as an high-level interface for converting
entire domain names to and from the ACE encoded form. The TLD API
consists of one set of functions to extract the TLD name from a domain
string, one set of functions to locate the proper TLD table to use
based on the TLD name, and core functions to validate a string against
a TLD table, and some utility wrappers to perform all the steps in one
call.
<p>The library is used by, e.g., GNU SASL and Shishi to process user
names and passwords. Libidn can be built into GNU Libc to enable a
new system-wide getaddrinfo flag for IDN processing.
<p>Libidn is developed for the GNU/Linux system, but runs on over 20 Unix
platforms (including Solaris, IRIX, AIX, and Tru64) and Windows. The
library is written in C and (parts of) the API is also accessible from
C++, Emacs Lisp, Python and Java. A native Java and C# port is
included.
<p>Also included is a command line tool, several self tests, code
examples, and more, all licensed under the GNU General Public License
version 3.0 or later (see <a href="#GNU-GPL">GNU GPL</a>).
<ul class="menu">
<li><a accesskey="1" href="#Getting-Started">Getting Started</a>
<li><a accesskey="2" href="#Features">Features</a>
<li><a accesskey="3" href="#Library-Overview">Library Overview</a>
<li><a accesskey="4" href="#Supported-Platforms">Supported Platforms</a>
<li><a accesskey="5" href="#Getting-help">Getting help</a>
<li><a accesskey="6" href="#Commercial-Support">Commercial Support</a>
<li><a accesskey="7" href="#Downloading-and-Installing">Downloading and Installing</a>
<li><a accesskey="8" href="#Bug-Reports">Bug Reports</a>
<li><a accesskey="9" href="#Contributing">Contributing</a>
</ul>
<div class="node">
<a name="Getting-Started"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Features">Features</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.1 Getting Started</h3>
<p>This manual documents the library programming interface. All
functions and data types provided by the library are explained.
Included are also examples, and documentation for the command line
tool <samp><span class="file">idn</span></samp> that provide a quick interface to the library. The
Emacs Lisp bindings for the library is also discussed.
<p>The reader is assumed to possess basic familiarity with
internationalization concepts and network programming in C or C++.
<p>This manual can be used in several ways. If read from the beginning
to the end, it gives a good introduction into the library and how it
can be used in an application. Forward references are included where
necessary. Later on, the manual can be used as a reference manual to
get just the information needed about any particular interface of the
library. Experienced programmers might want to start looking at the
examples at the end of the manual (see <a href="#Examples">Examples</a>), and then only
read up those parts of the interface which are unclear.
<div class="node">
<a name="Features"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Library-Overview">Library Overview</a>,
Previous: <a rel="previous" accesskey="p" href="#Getting-Started">Getting Started</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.2 Features</h3>
<p>This library might have a couple of advantages over other libraries
doing a similar job.
<dl>
<dt>It's Free Software<dd>Anybody can use, modify, and redistribute it under the terms of the
GNU Lesser General Public License version 2.1 or later (see <a href="#GNU-LGPL">GNU LGPL</a>).
<br><dt>It's thread-safe<dd>No global state is kept in the library. All functions are reentrant.
<br><dt>It's portable<dd>The code is intended to be written in pure ANSI C89. It has been
tested on many Unix like operating systems, and Windows.
<br><dt>It's modularized<dd>The library is composed of several modules, and the only interaction
between modules is through each modules' public API. If you only need
one piece of functionality, it is possible to take the files you need
and incorporate them into your own project.
<br><dt>It's not bloated<dd>The design of the library is based on the smallest API necessary to
implement the basic functionality. It has been carefully extended
with a small number of high-level wrappers to make it comfortable to
use the library. However, it does not implement additional
functionality just for the sake of completeness.
<br><dt>It's documented<dd>Sadly, not all software comes with documentation these days. This one
does.
</dl>
<div class="node">
<a name="Library-Overview"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Supported-Platforms">Supported Platforms</a>,
Previous: <a rel="previous" accesskey="p" href="#Features">Features</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.3 Library Overview</h3>
<p>The following illustration show the components that make up Libidn,
and how your application relates to the library. In the illustration,
various components are shown as boxes. You see the generic StringPrep
component, the various StringPrep profiles including Nameprep, the
Punycode component, the IDNA component, and the TLD component. The
arrows indicate aggregation, e.g., IDNA uses Punycode and Nameprep,
and in turn Nameprep uses the generic StringPrep interface. The
interfaces to all components are available for applications, no
component within the library is hidden from the application.
<div class="block-image"><img src="libidn-components.png" alt="libidn-components.png"></div>
<div class="node">
<a name="Supported-Platforms"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Getting-help">Getting help</a>,
Previous: <a rel="previous" accesskey="p" href="#Library-Overview">Library Overview</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.4 Supported Platforms</h3>
<p>Libidn has at some point in time been tested on the following
platforms. Online build reports for each platforms and Libidn version
is available at <a href="http://autobuild.josefsson.org/libidn/">http://autobuild.josefsson.org/libidn/</a>.
<ol type=1 start=1>
<li>Debian GNU/Linux 3.0 (Woody)
<a name="index-Debian-1"></a>
GCC 2.95.4 and GNU Make. This is the main development platform.
<code>alphaev67-unknown-linux-gnu</code>, <code>alphaev6-unknown-linux-gnu</code>,
<code>arm-unknown-linux-gnu</code>, <code>armv4l-unknown-linux-gnu</code>,
<code>hppa-unknown-linux-gnu</code>, <code>hppa64-unknown-linux-gnu</code>,
<code>i686-pc-linux-gnu</code>, <code>ia64-unknown-linux-gnu</code>,
<code>m68k-unknown-linux-gnu</code>, <code>mips-unknown-linux-gnu</code>,
<code>mipsel-unknown-linux-gnu</code>, <code>powerpc-unknown-linux-gnu</code>,
<code>s390-ibm-linux-gnu</code>, <code>sparc-unknown-linux-gnu</code>,
<code>sparc64-unknown-linux-gnu</code>.
<li>Debian GNU/Linux 2.1
<a name="index-Debian-2"></a>
GCC 2.95.1 and GNU Make. <code>armv4l-unknown-linux-gnu</code>.
<li>Tru64 UNIX
<a name="index-Tru64-3"></a>
Tru64 UNIX C compiler and Tru64 Make. <code>alphaev67-dec-osf5.1</code>,
<code>alphaev68-dec-osf5.1</code>.
<li>SuSE Linux 7.1
<a name="index-SuSE-4"></a>
GCC 2.96 and GNU Make. <code>alphaev6-unknown-linux-gnu</code>,
<code>alphaev67-unknown-linux-gnu</code>.
<li>SuSE Linux 7.2a
<a name="index-SuSE-Linux-5"></a>
GCC 3.0 and GNU Make. <code>ia64-unknown-linux-gnu</code>.
<li>SuSE Linux
<a name="index-SuSE-Linux-6"></a>
GCC 3.2.2 and GNU Make. <code>x86_64-unknown-linux-gnu</code> (AMD64
Opteron “Melody”).
<li>SuSE Enterprise Server 9 on IBM OpenPower 720
<a name="index-SuSE-Linux-7"></a><a name="index-OpenPower-720-8"></a>
GCC 3.3.3 and GNU Make. <code>powerpc64-unknown-linux-gnu</code>.
<li>RedHat Linux 7.2
<a name="index-RedHat-9"></a>
GCC 2.96 and GNU Make. <code>alphaev6-unknown-linux-gnu</code>,
<code>alphaev67-unknown-linux-gnu</code>, <code>ia64-unknown-linux-gnu</code>.
<li>RedHat Linux 8.0
<a name="index-RedHat-10"></a>
GCC 3.2 and GNU Make. <code>i686-pc-linux-gnu</code>.
<li>RedHat Advanced Server 2.1
<a name="index-RedHat-Advanced-Server-11"></a>
GCC 2.96 and GNU Make. <code>i686-pc-linux-gnu</code>.
<li>Slackware Linux 8.0.01
<a name="index-RedHat-12"></a>
GCC 2.95.3 and GNU Make. <code>i686-pc-linux-gnu</code>.
<li>Mandrake Linux 9.0
<a name="index-Mandrake-13"></a>
GCC 3.2 and GNU Make. <code>i686-pc-linux-gnu</code>.
<li>IRIX 6.5
<a name="index-IRIX-14"></a>
MIPS C compiler, IRIX Make. <code>mips-sgi-irix6.5</code>.
<li>AIX 4.3.2
<a name="index-AIX-15"></a>
IBM C for AIX compiler, AIX Make. <code>rs6000-ibm-aix4.3.2.0</code>.
<li>Microsoft Windows 2000 (Cygwin)
<a name="index-Windows-16"></a>
GCC 3.2, GNU make. <code>i686-pc-cygwin</code>.
<li>HP-UX 11
<a name="index-HP_002dUX-17"></a>
HP-UX C compiler and HP Make. <code>ia64-hp-hpux11.22</code>,
<code>hppa2.0w-hp-hpux11.11</code>.
<li>SUN Solaris 2.7
<a name="index-Solaris-18"></a>
GCC 3.0.4 and GNU Make. <code>sparc-sun-solaris2.7</code>.
<li>SUN Solaris 2.8
<a name="index-Solaris-19"></a>
Sun WorkShop Compiler C 6.0 and SUN Make. <code>sparc-sun-solaris2.8</code>.
<li>SUN Solaris 2.9
<a name="index-Solaris-20"></a>
Sun Forte Developer 7 C compiler and GNU
Make. <code>sparc-sun-solaris2.9</code>.
<li>NetBSD 1.6
<a name="index-NetBSD-21"></a>
GCC 2.95.3 and GNU Make. <code>alpha-unknown-netbsd1.6</code>,
<code>i386-unknown-netbsdelf1.6</code>.
<li>OpenBSD 3.1 and 3.2
<a name="index-OpenBSD-22"></a>
GCC 2.95.3 and GNU Make. <code>alpha-unknown-openbsd3.1</code>,
<code>i386-unknown-openbsd3.1</code>.
<li>FreeBSD 4.7 and 4.8
<a name="index-FreeBSD-23"></a>
GCC 2.95.4 and GNU Make. <code>alpha-unknown-freebsd4.7</code>,
<code>alpha-unknown-freebsd4.8</code>, <code>i386-unknown-freebsd4.7</code>,
<code>i386-unknown-freebsd4.8</code>.
<li>MacOS X 10.2 Server Edition
<a name="index-MacOS-X-24"></a>
GCC 3.1 and GNU Make. <code>powerpc-apple-darwin6.5</code>.
<li>MacOS X 10.4 “Tiger” with Xcode 2.0
<a name="index-MacOS-X-25"></a>
GCC 4.0 and GNU Make. <code>powerpc-apple-darwin8.0</code>.
<li>Cross compiled to uClinux/uClibc on Motorola Coldfire
<a name="index-Motorola-Coldfire-26"></a><a name="index-uClinux-27"></a><a name="index-uClibc-28"></a>
GCC 3.4 and GNU Make <code>m68k-uclinux-elf</code>.
<li>Cross compiled to ARM using Glibc
<a name="index-ARM-29"></a>
GCC 2.95 and GNU Make <code>arm-linux</code>.
<li>Cross compiled to Mingw32.
<a name="index-Windows-30"></a><a name="index-Microsoft-31"></a><a name="index-mingw32-32"></a>
GCC 3.4.4 and GNU Make <code>i586-mingw32msvc</code>.
</ol>
<p>If you use Libidn on, or port Libidn to, a new platform please report
it to the author.
<div class="node">
<a name="Getting-help"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Commercial-Support">Commercial Support</a>,
Previous: <a rel="previous" accesskey="p" href="#Supported-Platforms">Supported Platforms</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.5 Getting help</h3>
<p>A mailing list where users of Libidn may help each other exists, and
you can reach it by sending e-mail to <a href="mailto:help-libidn@gnu.org">help-libidn@gnu.org</a>.
Archives of the mailing list discussions, and an interface to manage
subscriptions, is available through the World Wide Web at
<a href="http://lists.gnu.org/mailman/listinfo/help-libidn">http://lists.gnu.org/mailman/listinfo/help-libidn</a>.
<div class="node">
<a name="Commercial-Support"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Downloading-and-Installing">Downloading and Installing</a>,
Previous: <a rel="previous" accesskey="p" href="#Getting-help">Getting help</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.6 Commercial Support</h3>
<p>Commercial support is available for users of GNU Libidn. The kind of
support that can be purchased may include:
<ul>
<li>Implement new features.
Such as country code specific profiling to support a restricted subset
of Unicode.
<li>Port Libidn to new platforms.
This could include porting Libidn to an embedded platforms that may
need memory or size optimization.
<li>Integrating IDN support in your existing project.
<li>System design of components related to IDN.
</ul>
<p>If you are interested, please write to:
<pre class="verbatim">Simon Josefsson Datakonsult
Hagagatan 24
113 47 Stockholm
Sweden
E-mail: simon@josefsson.org
</pre>
<p>If your company provide support related to GNU Libidn and would like
to be mentioned here, contact the author (see <a href="#Bug-Reports">Bug Reports</a>).
<div class="node">
<a name="Downloading-and-Installing"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Bug-Reports">Bug Reports</a>,
Previous: <a rel="previous" accesskey="p" href="#Commercial-Support">Commercial Support</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.7 Downloading and Installing</h3>
<p><a name="index-Installation-33"></a><a name="index-Download-34"></a>
The package can be downloaded from several places, including:
<p><a href="ftp://alpha.gnu.org/pub/gnu/libidn/">ftp://alpha.gnu.org/pub/gnu/libidn/</a>
<p>The latest version is stored in a file, e.g.,
‘<samp><span class="samp">libidn-1.15.tar.gz</span></samp>’ where the ‘<samp><span class="samp">1.15</span></samp>’
value is the highest version number in the directory.
<p>The package is then extracted, configured and built like many other
packages that use Autoconf. For detailed information on configuring
and building it, refer to the <samp><span class="file">INSTALL</span></samp> file that is part of the
distribution archive.
<p>Here is an example terminal session that download, configure, build
and install the package. You will need a few basic tools, such as
‘<samp><span class="samp">sh</span></samp>’, ‘<samp><span class="samp">make</span></samp>’ and ‘<samp><span class="samp">cc</span></samp>’.
<pre class="example"> $ wget -q ftp://alpha.gnu.org/pub/gnu/libidn/libidn-1.15.tar.gz
$ tar xfz libidn-1.15.tar.gz
$ cd libidn-1.15/
$ ./configure
...
$ make
...
$ make install
...
</pre>
<p>After that Libidn should be properly installed and ready for use.
<p>A few <code>configure</code> options may be relevant, summarized in the
table.
<dl>
<dt><code>--enable-java</code><dd>Build the Java port into a *.JAR file. See <a href="#Java-API">Java API</a>, for more
information.
<br><dt><code>--disable-tld</code><dd>Disable the TLD module. This would typically only be useful if you
are building on a memory restricted platforms. See <a href="#TLD-Functions">TLD Functions</a>,
for more information.
<br><dt><code>--enable-csharp[=IMPL]</code><dd>Build the <code>C#</code> port into a <code>*.DLL</code> file. See <a href="#C_0023-API">C# API</a>, for
more information. Here, <code>IMPL</code> is <code>pnet</code> or <code>mono</code>,
indicating whether the PNET <samp><span class="command">cscc</span></samp> compiler or the Mono
<samp><span class="command">mcs</span></samp> compiler should be used, respectively.
</dl>
<p>For the complete list, refer to the output from <code>configure
--help</code>.
<ul class="menu">
<li><a accesskey="1" href="#Installing-under-Windows">Installing under Windows</a>: Windows specific build instructions.
</ul>
<div class="node">
<a name="Installing-under-Windows"></a>
<p><hr>
Up: <a rel="up" accesskey="u" href="#Downloading-and-Installing">Downloading and Installing</a>
</div>
<h4 class="subsection">1.7.1 Installing under Windows</h4>
<p>There are two ways to build Libidn on Windows: via MinGW or via Visual
Studio.
<p>With MinGW, you can build a Libidn DLL and use it from other
applications. After installing MinGW (<a href="http://mingw.org/">http://mingw.org/</a>) follow
the generic installation instructions (see <a href="#Downloading-and-Installing">Downloading and Installing</a>). The DLL is installed by default.
<p>For information on how to use the DLL in other applications, see:
<a href="http://www.mingw.org/mingwfaq.shtml#faq-msvcdll">http://www.mingw.org/mingwfaq.shtml#faq-msvcdll</a>.
<p>You can build Libidn as a native Visual Studio C++ project. This
allows you to build the code for other platforms that VS supports,
such as Windows Mobile. You need Visual Studio 2005 or later.
<p>First download and unpack the archive as described in the generic
installation instructions (see <a href="#Downloading-and-Installing">Downloading and Installing</a>). Don't
run <code>./configure</code>. Instead, start Visual Studio and open the
project file <samp><span class="file">win32/libidn.sln</span></samp> inside the Libidn directory. You
should be able to build the project using Build Project.
<p>Output libraries will be written into the <code>win32/lib</code> (or
<code>win32/lib/debug</code> for Debug versions) folder.
<p>When working with Windows you may want to look into the special memory
handling functions that may be needed (see <a href="#Memory-handling-under-Windows">Memory handling under Windows</a>).
<div class="node">
<a name="Bug-Reports"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Contributing">Contributing</a>,
Previous: <a rel="previous" accesskey="p" href="#Downloading-and-Installing">Downloading and Installing</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.8 Bug Reports</h3>
<p><a name="index-Reporting-Bugs-35"></a>
If you think you have found a bug in Libidn, please investigate it and
report it.
<ul>
<li>Please make sure that the bug is really in Libidn, and
preferably also check that it hasn't already been fixed in the latest
version.
<li>You have to send us a test case that makes it possible for us to
reproduce the bug.
<li>You also have to explain what is wrong; if you get a crash, or
if the results printed are not good and in that case, in what way.
Make sure that the bug report includes all information you would need
to fix this kind of bug for someone else.
</ul>
<p>Please make an effort to produce a self-contained report, with
something definite that can be tested or debugged. Vague queries or
piecemeal messages are difficult to act on and don't help the
development effort.
<p>If your bug report is good, we will do our best to help you to get a
corrected version of the software; if the bug report is poor, we won't
do anything about it (apart from asking you to send better bug
reports).
<p>If you think something in this manual is unclear, or downright
incorrect, or if the language needs to be improved, please also send a
note.
<p>Send your bug report to:
<div align="center">‘<samp><span class="samp">bug-libidn@gnu.org</span></samp>’</div>
<div class="node">
<a name="Contributing"></a>
<p><hr>
Previous: <a rel="previous" accesskey="p" href="#Bug-Reports">Bug Reports</a>,
Up: <a rel="up" accesskey="u" href="#Introduction">Introduction</a>
</div>
<h3 class="section">1.9 Contributing</h3>
<p><a name="index-Contributing-36"></a><a name="index-Hacking-37"></a>
If you want to submit a patch for inclusion – from solve a typo you
discovered, up to adding support for a new feature – you should
submit it as a bug report (see <a href="#Bug-Reports">Bug Reports</a>). There are some
things that you can do to increase the chances for it to be included
in the official package.
<p>Unless your patch is very small (say, under 10 lines) we require that
you assign the copyright of your work to the Free Software Foundation.
This is to protect the freedom of the project. If you have not
already signed papers, we will send you the necessary information when
you submit your contribution.
<p>For contributions that doesn't consist of actual programming code, the
only guidelines are common sense. Use it.
<p>For code contributions, a number of style guides will help you:
<ul>
<li>Coding Style.
Follow the GNU Standards document (see <a href="standards.html#Top">GNU Coding Standards</a>).
<p>If you normally code using another coding standard, there is no
problem, but you should use ‘<samp><span class="samp">indent</span></samp>’ to reformat the code
(see <a href="indent.html#Top">GNU Indent</a>) before submitting your work.
<li>Use the unified diff format ‘<samp><span class="samp">diff -u</span></samp>’.
<li>Return errors.
No reason whatsoever should abort the execution of the library. Even
memory allocation errors, e.g. when malloc return NULL, should work
although result in an error code.
<li>Design with thread safety in mind.
Don't use global variables and the like.
<li>Avoid using the C math library.
It causes problems for embedded implementations, and in most
situations it is very easy to avoid using it.
<li>Document your functions.
Use comments before each function headers, that, if properly
formatted, are extracted into GTK-DOC web pages. Don't forget to
update the Texinfo manual as well.
<li>Supply a ChangeLog and NEWS entries, where appropriate.
</ul>
<!-- ********************************************************** -->
<!-- ******************* Preparation ************************ -->
<!-- ********************************************************** -->
<div class="node">
<a name="Preparation"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Utility-Functions">Utility Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#Introduction">Introduction</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">2 Preparation</h2>
<p>To use `Libidn', you have to perform some changes to your sources and
the build system. The necessary changes are small and explained in
the following sections. At the end of this chapter, it is described
how the library is initialized, and how the requirements of the
library are verified.
<p>A faster way to find out how to adapt your application for use with
`Libidn' may be to look at the examples at the end of this manual
(see <a href="#Examples">Examples</a>).
<ul class="menu">
<li><a accesskey="1" href="#Header">Header</a>
<li><a accesskey="2" href="#Initialization">Initialization</a>
<li><a accesskey="3" href="#Version-Check">Version Check</a>
<li><a accesskey="4" href="#Building-the-source">Building the source</a>
<li><a accesskey="5" href="#Autoconf-tests">Autoconf tests</a>
<li><a accesskey="6" href="#Memory-handling-under-Windows">Memory handling under Windows</a>
</ul>
<div class="node">
<a name="Header"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Initialization">Initialization</a>,
Up: <a rel="up" accesskey="u" href="#Preparation">Preparation</a>
</div>
<h3 class="section">2.1 Header</h3>
<p>The library contains a few independent parts, and each part export the
interfaces (data types and functions) in a header file. You must
include the appropriate header files in all programs using the
library, either directly or through some other header file, like this:
<pre class="example"> #include <stringprep.h>
</pre>
<p>The header files and the functions they define are categorized as
follows:
<dl>
<dt>stringprep.h<dd>
The low-level stringprep API entry point. For IDN applications, this
is usually invoked via IDNA. Some applications, specifically non-IDN
ones, may want to prepare strings directly though, and should include
this header file.
<p>The name space of the stringprep part of Libidn is <code>stringprep*</code>
for function names, <code>Stringprep*</code> for data types and
<code>STRINGPREP_*</code> for other symbols. In addition,
<code>_stringprep*</code> is reserved for internal use and should never be
used by applications.
<br><dt>punycode.h<dd>
The entry point to Punycode encoding and decoding functions. Normally
punycode is used via the idna.h interface, but some application may
want to perform raw punycode operations.
<p>The name space of the punycode part of Libidn is <code>punycode_*</code> for
function names, <code>Punycode*</code> for data types and <code>PUNYCODE_*</code>
for other symbols. In addition, <code>_punycode*</code> is reserved for
internal use and should never be used by applications.
<br><dt>idna.h<dd>
The entry point to the IDNA functions. This is the normal entry point
for applications that need IDN functionality.
<p>The name space of the IDNA part of Libidn is <code>idna_*</code> for
function names, <code>Idna*</code> for data types and <code>IDNA_*</code> for
other symbols. In addition, <code>_idna*</code> is reserved for internal
use and should never be used by applications.
<br><dt>tld.h<dd>
The entry point to the TLD functions. Normal applications are not
expected to need this functionality, but it is present for
applications that are used by TLDs to validate customer input.
<p>The name space of the TLD part of Libidn is <code>tld_*</code> for function
names, <code>Tld_*</code> for data types and <code>TLD_*</code> for other symbols.
In addition, <code>_tld*</code> is reserved for internal use and should
never be used by applications.
<br><dt>pr29.h<dd>
The entry point to the PR29 functions. These functions are used to
detect “problem sequences” (see <a href="#PR29-Functions">PR29 Functions</a>), mostly for use
in security critical applications.
<p>The name space of the PR29 part of Libidn is <code>pr29_*</code> for
function names, <code>Pr29_*</code> for data types and <code>PR29_*</code> for
other symbols. In addition, <code>_pr29*</code> is reserved for internal
use and should never be used by applications.
<br><dt>idn-free.h<dd>
The entry point to the Windows memory de-allocation function
(see <a href="#Memory-handling-under-Windows">Memory handling under Windows</a>). It contains only one
function <code>idn_free</code>.
</dl>
<p>All header files defined and use the symbol <code>IDNAPI</code> to decorate
the API functions.
<div class="node">
<a name="Initialization"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Version-Check">Version Check</a>,
Previous: <a rel="previous" accesskey="p" href="#Header">Header</a>,
Up: <a rel="up" accesskey="u" href="#Preparation">Preparation</a>
</div>
<h3 class="section">2.2 Initialization</h3>
<p>Libidn is stateless and does not need any initialization.
<div class="node">
<a name="Version-Check"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Building-the-source">Building the source</a>,
Previous: <a rel="previous" accesskey="p" href="#Initialization">Initialization</a>,
Up: <a rel="up" accesskey="u" href="#Preparation">Preparation</a>
</div>
<h3 class="section">2.3 Version Check</h3>
<p>It is often desirable to check that the version of `Libidn' used is
indeed one which fits all requirements. Even with binary
compatibility new features may have been introduced but due to problem
with the dynamic linker an old version is actually used. So you may
want to check that the version is okay right after program startup.
<h4 class="subheading">stringprep_check_version</h4>
<p><a name="stringprep_005fcheck_005fversion"></a>
<div class="defun">
— Function: const char * <b>stringprep_check_version</b> (<var>const char * req_version</var>)<var><a name="index-stringprep_005fcheck_005fversion-38"></a></var><br>
<blockquote><p><var>req_version</var>: Required version number, or NULL.
<p>Check that the version of the library is at minimum the requested one
and return the version string; return NULL if the condition is not
satisfied. If a NULL is passed to this function, no check is done,
but the version string is simply returned.
<p>See <code>STRINGPREP_VERSION</code> for a suitable <code>req_version</code> string.
<p><strong>Return value:</strong> Version string of run-time library, or NULL if the
run-time library does not meet the required version number.
</p></blockquote></div>
<p>The normal way to use the function is to put something similar to the
following first in your <code>main</code>:
<pre class="example"> if (!stringprep_check_version (STRINGPREP_VERSION))
{
printf ("stringprep_check_version() failed:\n"
"Header file incompatible with shared library.\n");
exit(1);
}
</pre>
<div class="node">
<a name="Building-the-source"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Autoconf-tests">Autoconf tests</a>,
Previous: <a rel="previous" accesskey="p" href="#Version-Check">Version Check</a>,
Up: <a rel="up" accesskey="u" href="#Preparation">Preparation</a>
</div>
<h3 class="section">2.4 Building the source</h3>
<p><a name="index-Compiling-your-application-39"></a>
If you want to compile a source file including e.g. the `idna.h' header
file, you must make sure that the compiler can find it in the
directory hierarchy. This is accomplished by adding the path to the
directory in which the header file is located to the compilers include
file search path (via the <samp><span class="option">-I</span></samp> option).
<p>However, the path to the include file is determined at the time the
source is configured. To solve this problem, `Libidn' uses the
external package <samp><span class="command">pkg-config</span></samp> that knows the path to the
include file and other configuration options. The options that need
to be added to the compiler invocation at compile time are output by
the <samp><span class="option">--cflags</span></samp> option to <samp><span class="command">pkg-config libidn</span></samp>. The
following example shows how it can be used at the command line:
<pre class="example"> gcc -c foo.c `pkg-config libidn --cflags`
</pre>
<p>Adding the output of ‘<samp><span class="samp">pkg-config libidn --cflags</span></samp>’ to the
compilers command line will ensure that the compiler can find e.g. the
idna.h header file.
<p>A similar problem occurs when linking the program with the library.
Again, the compiler has to find the library files. For this to work,
the path to the library files has to be added to the library search
path (via the <samp><span class="option">-L</span></samp> option). For this, the option
<samp><span class="option">--libs</span></samp> to <samp><span class="command">pkg-config libidn</span></samp> can be used. For
convenience, this option also outputs all other options that are
required to link the program with the `libidn' libarary. The example
shows how to link <samp><span class="file">foo.o</span></samp> with the `libidn' library to a program
<samp><span class="command">foo</span></samp>.
<pre class="example"> gcc -o foo foo.o `pkg-config libidn --libs`
</pre>
<p>Of course you can also combine both examples to a single command by
specifying both options to <samp><span class="command">pkg-config</span></samp>:
<pre class="example"> gcc -o foo foo.c `pkg-config libidn --cflags --libs`
</pre>
<div class="node">
<a name="Autoconf-tests"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Memory-handling-under-Windows">Memory handling under Windows</a>,
Previous: <a rel="previous" accesskey="p" href="#Building-the-source">Building the source</a>,
Up: <a rel="up" accesskey="u" href="#Preparation">Preparation</a>
</div>
<h3 class="section">2.5 Autoconf tests</h3>
<p><a name="index-Autoconf-tests-40"></a><a name="index-Configure-tests-41"></a>
If your project uses Autoconf (see <a href="autoconf.html#Top">GNU Autoconf</a>)
to check for installed libraries, you might find the following snippet
illustrative. It add a new <samp><span class="file">configure</span></samp> parameter
<code>--with-libidn</code>, and check for <samp><span class="file">idna.h</span></samp> and ‘<samp><span class="samp">-lidn</span></samp>’
(possibly below the directory specified as the optional argument to
<code>--with-libidn</code>), and define the <acronym>CPP</acronym> symbol
<code>LIBIDN</code> if the library is found. The default behaviour is to
search for the library and enable the functionality (that is, define
the symbol) when the library is found, but if you wish to make the
default behaviour of your package be that Libidn is not used (even if
it is installed on the system), change ‘<samp><span class="samp">libidn=yes</span></samp>’ to
‘<samp><span class="samp">libidn=no</span></samp>’ on the third line.
<pre class="example"> AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
[Support IDN (needs GNU Libidn)]),
libidn=$withval, libidn=yes)
if test "$libidn" != "no"; then
if test "$libidn" != "yes"; then
LDFLAGS="${LDFLAGS} -L$libidn/lib"
CPPFLAGS="${CPPFLAGS} -I$libidn/include"
fi
AC_CHECK_HEADER(idna.h,
AC_CHECK_LIB(idn, stringprep_check_version,
[libidn=yes LIBS="${LIBS} -lidn"], libidn=no),
libidn=no)
fi
if test "$libidn" != "no" ; then
AC_DEFINE(LIBIDN, 1, [Define to 1 if you want IDN support.])
else
AC_MSG_WARN([Libidn not found])
fi
AC_MSG_CHECKING([if Libidn should be used])
AC_MSG_RESULT($libidn)
</pre>
<p>If you require that your users have installed <code>pkg-config</code> (which
I cannot recommend generally), the above can be done more easily as
follows.
<pre class="example"> AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
[Support IDN (needs GNU Libidn)]),
libidn=$withval, libidn=yes)
if test "$libidn" != "no" ; then
PKG_CHECK_MODULES(LIBIDN, libidn >= 0.0.0, [libidn=yes], [libidn=no])
if test "$libidn" != "yes" ; then
libidn=no
AC_MSG_WARN([Libidn not found])
else
libidn=yes
AC_DEFINE(LIBIDN, 1, [Define to 1 if you want Libidn.])
fi
fi
AC_MSG_CHECKING([if Libidn should be used])
AC_MSG_RESULT($libidn)
</pre>
<div class="node">
<a name="Memory-handling-under-Windows"></a>
<p><hr>
Previous: <a rel="previous" accesskey="p" href="#Autoconf-tests">Autoconf tests</a>,
Up: <a rel="up" accesskey="u" href="#Preparation">Preparation</a>
</div>
<h3 class="section">2.6 Memory handling under Windows</h3>
<p><a name="index-free-42"></a><a name="index-Memory-handling-43"></a><a name="index-de_002dallocation-44"></a><a name="index-heap-memory-45"></a>
Several functions in the library allocates memory. The memory is
expected to be de-allocated using the <code>free</code> function. Under
Windows, it is sometimes necessary to de-allocate memory in the same
module that allocated a memory region. The reason is that different
modules use separate heap memory regions. To solve this problem we
provide a function to de-allocate memory inside the library.
<p>Note that we do not recommend using this interface generally if you do
not care about Windows portability.
<h3 class="section">2.7 Header file <code>idn-free.h</code></h3>
<p>To use the function explained in this chapter, you need to include the
file <samp><span class="file">idn-free.h</span></samp> using:
<pre class="example"> #include <idn-free.h>
</pre>
<h3 class="section">2.8 Memory de-allocation function</h3>
<h4 class="subheading">idn_free</h4>
<p><a name="idn_005ffree"></a>
<div class="defun">
— Function: void <b>idn_free</b> (<var>void * ptr</var>)<var><a name="index-idn_005ffree-46"></a></var><br>
<blockquote><p><var>ptr</var>: memory region to deallocate, or <code>NULL</code>.
<p>Deallocates memory region by calling <code>free()</code>. If <code>ptr</code> is <code>NULL</code> no
operation is performed.
<p>Normally applications de-allocate strings allocated by libidn by
calling <code>free()</code> directly. Under Windows, different parts of the
same application may use different heap memory, and then it is
important to deallocate memory allocated within the same module
that allocated it. This function makes that possible.
</p></blockquote></div>
<!-- ********************************************************** -->
<!-- ******************** Utility Functions ****************** -->
<!-- ********************************************************** -->
<div class="node">
<a name="Utility-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Stringprep-Functions">Stringprep Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#Preparation">Preparation</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">3 Utility Functions</h2>
<p><a name="index-Utility-Functions-47"></a>
The rest of this library makes extensive use of Unicode characters.
In order to interface this library with the outside world, your
application may need to make various Unicode transformations.
<h3 class="section">3.1 Header file <code>stringprep.h</code></h3>
<p>To use the functions explained in this chapter, you need to include
the file <samp><span class="file">stringprep.h</span></samp> using:
<pre class="example"> #include <stringprep.h>
</pre>
<h3 class="section">3.2 Unicode Encoding Transformation</h3>
<h4 class="subheading">stringprep_unichar_to_utf8</h4>
<p><a name="stringprep_005funichar_005fto_005futf8"></a>
<div class="defun">
— Function: int <b>stringprep_unichar_to_utf8</b> (<var>uint32_t c, char * outbuf</var>)<var><a name="index-stringprep_005funichar_005fto_005futf8-48"></a></var><br>
<blockquote><p><var>c</var>: a ISO10646 character code
<p><var>outbuf</var>: output buffer, must have at least 6 bytes of space.
If <code>NULL</code>, the length will be computed and returned
and nothing will be written to <code>outbuf</code>.
<p>Converts a single character to UTF-8.
<p><strong>Return value:</strong> number of bytes written.
</p></blockquote></div>
<h4 class="subheading">stringprep_utf8_to_unichar</h4>
<p><a name="stringprep_005futf8_005fto_005funichar"></a>
<div class="defun">
— Function: uint32_t <b>stringprep_utf8_to_unichar</b> (<var>const char * p</var>)<var><a name="index-stringprep_005futf8_005fto_005funichar-49"></a></var><br>
<blockquote><p><var>p</var>: a pointer to Unicode character encoded as UTF-8
<p>Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
If <code>p</code> does not point to a valid UTF-8 encoded character, results are
undefined.
<p><strong>Return value:</strong> the resulting character.
</p></blockquote></div>
<h4 class="subheading">stringprep_ucs4_to_utf8</h4>
<p><a name="stringprep_005fucs4_005fto_005futf8"></a>
<div class="defun">
— Function: char * <b>stringprep_ucs4_to_utf8</b> (<var>const uint32_t * str, ssize_t len, size_t * items_read, size_t * items_written</var>)<var><a name="index-stringprep_005fucs4_005fto_005futf8-50"></a></var><br>
<blockquote><p><var>str</var>: a UCS-4 encoded string
<p><var>len</var>: the maximum length of <code>str</code> to use. If <code>len</code> < 0, then
the string is terminated with a 0 character.
<p><var>items_read</var>: location to store number of characters read read, or <code>NULL</code>.
<p><var>items_written</var>: location to store number of bytes written or <code>NULL</code>.
The value here stored does not include the trailing 0
byte.
<p>Convert a string from a 32-bit fixed width representation as UCS-4.
to UTF-8. The result will be terminated with a 0 byte.
<p><strong>Return value:</strong> a pointer to a newly allocated UTF-8 string.
This value must be deallocated by the caller.
If an error occurs, <code>NULL</code> will be returned and <code>error</code>
set.
</p></blockquote></div>
<h4 class="subheading">stringprep_utf8_to_ucs4</h4>
<p><a name="stringprep_005futf8_005fto_005fucs4"></a>
<div class="defun">
— Function: uint32_t * <b>stringprep_utf8_to_ucs4</b> (<var>const char * str, ssize_t len, size_t * items_written</var>)<var><a name="index-stringprep_005futf8_005fto_005fucs4-51"></a></var><br>
<blockquote><p><var>str</var>: a UTF-8 encoded string
<p><var>len</var>: the maximum length of <code>str</code> to use. If <code>len</code> < 0, then
the string is nul-terminated.
<p><var>items_written</var>: location to store the number of characters in the
result, or <code>NULL</code>.
<p>Convert a string from UTF-8 to a 32-bit fixed width
representation as UCS-4, assuming valid UTF-8 input.
This function does no error checking on the input.
<p><strong>Return value:</strong> a pointer to a newly allocated UCS-4 string.
This value must be deallocated by the caller.
</p></blockquote></div>
<h3 class="section">3.3 Unicode Normalization</h3>
<h4 class="subheading">stringprep_ucs4_nfkc_normalize</h4>
<p><a name="stringprep_005fucs4_005fnfkc_005fnormalize"></a>
<div class="defun">
— Function: uint32_t * <b>stringprep_ucs4_nfkc_normalize</b> (<var>uint32_t * str, ssize_t len</var>)<var><a name="index-stringprep_005fucs4_005fnfkc_005fnormalize-52"></a></var><br>
<blockquote><p><var>str</var>: a Unicode string.
<p><var>len</var>: length of <code>str</code> array, or -1 if <code>str</code> is nul-terminated.
<p>Converts UCS4 string into UTF-8 and runs
<code>stringprep_utf8_nfkc_normalize()</code>.
<p><strong>Return value:</strong> a newly allocated Unicode string, that is the NFKC
normalized form of <code>str</code>.
</p></blockquote></div>
<h4 class="subheading">stringprep_utf8_nfkc_normalize</h4>
<p><a name="stringprep_005futf8_005fnfkc_005fnormalize"></a>
<div class="defun">
— Function: char * <b>stringprep_utf8_nfkc_normalize</b> (<var>const char * str, ssize_t len</var>)<var><a name="index-stringprep_005futf8_005fnfkc_005fnormalize-53"></a></var><br>
<blockquote><p><var>str</var>: a UTF-8 encoded string.
<p><var>len</var>: length of <code>str</code>, in bytes, or -1 if <code>str</code> is nul-terminated.
<p>Converts a string into canonical form, standardizing
such issues as whether a character with an accent
is represented as a base character and combining
accent or as a single precomposed character.
<p>The normalization mode is NFKC (ALL COMPOSE). It standardizes
differences that do not affect the text content, such as the
above-mentioned accent representation. It standardizes the
"compatibility" characters in Unicode, such as SUPERSCRIPT THREE to
the standard forms (in this case DIGIT THREE). Formatting
information may be lost but for most text operations such
characters should be considered the same. It returns a result with
composed forms rather than a maximally decomposed form.
<p><strong>Return value:</strong> a newly allocated string, that is the
NFKC normalized form of <code>str</code>.
</p></blockquote></div>
<h3 class="section">3.4 Character Set Conversion</h3>
<h4 class="subheading">stringprep_locale_charset</h4>
<p><a name="stringprep_005flocale_005fcharset"></a>
<div class="defun">
— Function: const char * <b>stringprep_locale_charset</b> (<var> void</var>)<var><a name="index-stringprep_005flocale_005fcharset-54"></a></var><br>
<blockquote>
<p>Find out current locale charset. The function respect the CHARSET
environment variable, but typically uses nl_langinfo(CODESET) when
it is supported. It fall back on "ASCII" if CHARSET isn't set and
nl_langinfo isn't supported or return anything.
<p>Note that this function return the application's locale's preferred
charset (or thread's locale's preffered charset, if your system
support thread-specific locales). It does not return what the
system may be using. Thus, if you receive data from external
sources you cannot in general use this function to guess what
charset it is encoded in. Use stringprep_convert from the external
representation into the charset returned by this function, to have
data in the locale encoding.
<p><strong>Return value:</strong> Return the character set used by the current locale.
It will never return NULL, but use "ASCII" as a fallback.
</p></blockquote></div>
<h4 class="subheading">stringprep_convert</h4>
<p><a name="stringprep_005fconvert"></a>
<div class="defun">
— Function: char * <b>stringprep_convert</b> (<var>const char * str, const char * to_codeset, const char * from_codeset</var>)<var><a name="index-stringprep_005fconvert-55"></a></var><br>
<blockquote><p><var>str</var>: input zero-terminated string.
<p><var>to_codeset</var>: name of destination character set.
<p><var>from_codeset</var>: name of origin character set, as used by <code>str</code>.
<p>Convert the string from one character set to another using the
system's <code>iconv()</code> function.
<p><strong>Return value:</strong> Returns newly allocated zero-terminated string which
is <code>str</code> transcoded into to_codeset.
</p></blockquote></div>
<h4 class="subheading">stringprep_locale_to_utf8</h4>
<p><a name="stringprep_005flocale_005fto_005futf8"></a>
<div class="defun">
— Function: char * <b>stringprep_locale_to_utf8</b> (<var>const char * str</var>)<var><a name="index-stringprep_005flocale_005fto_005futf8-56"></a></var><br>
<blockquote><p><var>str</var>: input zero terminated string.
<p>Convert string encoded in the locale's character set into UTF-8 by
using <code>stringprep_convert()</code>.
<p><strong>Return value:</strong> Returns newly allocated zero-terminated string which
is <code>str</code> transcoded into UTF-8.
</p></blockquote></div>
<h4 class="subheading">stringprep_utf8_to_locale</h4>
<p><a name="stringprep_005futf8_005fto_005flocale"></a>
<div class="defun">
— Function: char * <b>stringprep_utf8_to_locale</b> (<var>const char * str</var>)<var><a name="index-stringprep_005futf8_005fto_005flocale-57"></a></var><br>
<blockquote><p><var>str</var>: input zero terminated string.
<p>Convert string encoded in UTF-8 into the locale's character set by
using <code>stringprep_convert()</code>.
<p><strong>Return value:</strong> Returns newly allocated zero-terminated string which
is <code>str</code> transcoded into the locale's character set.
</p></blockquote></div>
<!-- ********************************************************** -->
<!-- ****************** Stringprep Functions ***************** -->
<!-- ********************************************************** -->
<div class="node">
<a name="Stringprep-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Punycode-Functions">Punycode Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#Utility-Functions">Utility Functions</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">4 Stringprep Functions</h2>
<p><a name="index-Stringprep-Functions-58"></a>
Stringprep describes a framework for preparing Unicode text strings in
order to increase the likelihood that string input and string
comparison work in ways that make sense for typical users throughout
the world. The stringprep protocol is useful for protocol identifier
values, company and personal names, internationalized domain names,
and other text strings.
<h3 class="section">4.1 Header file <code>stringprep.h</code></h3>
<p>To use the functions explained in this chapter, you need to include
the file <samp><span class="file">stringprep.h</span></samp> using:
<pre class="example"> #include <stringprep.h>
</pre>
<h3 class="section">4.2 Defining A Stringprep Profile</h3>
<p>Further types and structures are defined for applications that want to
specify their own stringprep profile. As these are fairly obscure,
and by necessity tied to the implementation, we do not document them
here. Look into the <samp><span class="file">stringprep.h</span></samp> header file, and the
<samp><span class="file">profiles.c</span></samp> source code for the details.
<h3 class="section">4.3 Control Flags</h3>
<div class="defun">
— Stringprep flags: Stringprep_profile_flags <b>STRINGPREP_NO_NFKC</b><var><a name="index-STRINGPREP_005fNO_005fNFKC-59"></a></var><br>
<blockquote><p>Disable the NFKC normalization, as well as selecting the non-NFKC case
folding tables. Usually the profile specifies BIDI and NFKC settings,
and applications should not override it unless in special situations.
</p></blockquote></div>
<div class="defun">
— Stringprep flags: Stringprep_profile_flags <b>STRINGPREP_NO_BIDI</b><var><a name="index-STRINGPREP_005fNO_005fBIDI-60"></a></var><br>
<blockquote><p>Disable the BIDI step. Usually the profile specifies BIDI and NFKC
settings, and applications should not override it unless in special
situations.
</p></blockquote></div>
<div class="defun">
— Stringprep flags: Stringprep_profile_flags <b>STRINGPREP_NO_UNASSIGNED</b><var><a name="index-STRINGPREP_005fNO_005fUNASSIGNED-61"></a></var><br>
<blockquote><p>Make the library return with an error if string contains unassigned
characters according to profile.
</p></blockquote></div>
<h3 class="section">4.4 Core Functions</h3>
<h4 class="subheading">stringprep_4i</h4>
<p><a name="stringprep_005f4i"></a>
<div class="defun">
— Function: int <b>stringprep_4i</b> (<var>uint32_t * ucs4, size_t * len, size_t maxucs4len, Stringprep_profile_flags flags, const Stringprep_profile * profile</var>)<var><a name="index-stringprep_005f4i-62"></a></var><br>
<blockquote><p><var>ucs4</var>: input/output array with string to prepare.
<p><var>len</var>: on input, length of input array with Unicode code points,
on exit, length of output array with Unicode code points.
<p><var>maxucs4len</var>: maximum length of input/output array.
<p><var>flags</var>: a <code>Stringprep_profile_flags</code> value, or 0.
<p><var>profile</var>: pointer to <code>Stringprep_profile</code> to use.
<p>Prepare the input UCS-4 string according to the stringprep profile,
and write back the result to the input string.
<p>The input is not required to be zero terminated (<code>ucs4</code>[<code>len</code>] = 0).
The output will not be zero terminated unless <code>ucs4</code>[<code>len</code>] = 0.
Instead, see <code>stringprep_4zi()</code> if your input is zero terminated or
if you want the output to be.
<p>Since the stringprep operation can expand the string, <code>maxucs4len</code>
indicate how large the buffer holding the string is. This function
will not read or write to code points outside that size.
<p>The <code>flags</code> are one of <code>Stringprep_profile_flags</code> values, or 0.
<p>The <code>profile</code> contain the <code>Stringprep_profile</code> instructions to
perform. Your application can define new profiles, possibly
re-using the generic stringprep tables that always will be part of
the library, or use one of the currently supported profiles.
<p><strong>Return value:</strong> Returns <code>STRINGPREP_OK</code> iff successful, or an
<code>Stringprep_rc</code> error code.
</p></blockquote></div>
<h4 class="subheading">stringprep_4zi</h4>
<p><a name="stringprep_005f4zi"></a>
<div class="defun">
— Function: int <b>stringprep_4zi</b> (<var>uint32_t * ucs4, size_t maxucs4len, Stringprep_profile_flags flags, const Stringprep_profile * profile</var>)<var><a name="index-stringprep_005f4zi-63"></a></var><br>
<blockquote><p><var>ucs4</var>: input/output array with zero terminated string to prepare.
<p><var>maxucs4len</var>: maximum length of input/output array.
<p><var>flags</var>: a <code>Stringprep_profile_flags</code> value, or 0.
<p><var>profile</var>: pointer to <code>Stringprep_profile</code> to use.
<p>Prepare the input zero terminated UCS-4 string according to the
stringprep profile, and write back the result to the input string.
<p>Since the stringprep operation can expand the string, <code>maxucs4len</code>
indicate how large the buffer holding the string is. This function
will not read or write to code points outside that size.
<p>The <code>flags</code> are one of <code>Stringprep_profile_flags</code> values, or 0.
<p>The <code>profile</code> contain the <code>Stringprep_profile</code> instructions to
perform. Your application can define new profiles, possibly
re-using the generic stringprep tables that always will be part of
the library, or use one of the currently supported profiles.
<p><strong>Return value:</strong> Returns <code>STRINGPREP_OK</code> iff successful, or an
<code>Stringprep_rc</code> error code.
</p></blockquote></div>
<h4 class="subheading">stringprep</h4>
<p><a name="stringprep"></a>
<div class="defun">
— Function: int <b>stringprep</b> (<var>char * in, size_t maxlen, Stringprep_profile_flags flags, const Stringprep_profile * profile</var>)<var><a name="index-stringprep-64"></a></var><br>
<blockquote><p><var>in</var>: input/ouput array with string to prepare.
<p><var>maxlen</var>: maximum length of input/output array.
<p><var>flags</var>: a <code>Stringprep_profile_flags</code> value, or 0.
<p><var>profile</var>: pointer to <code>Stringprep_profile</code> to use.
<p>Prepare the input zero terminated UTF-8 string according to the
stringprep profile, and write back the result to the input string.
<p>Note that you must convert strings entered in the systems locale
into UTF-8 before using this function, see
<code>stringprep_locale_to_utf8()</code>.
<p>Since the stringprep operation can expand the string, <code>maxlen</code>
indicate how large the buffer holding the string is. This function
will not read or write to characters outside that size.
<p>The <code>flags</code> are one of <code>Stringprep_profile_flags</code> values, or 0.
<p>The <code>profile</code> contain the <code>Stringprep_profile</code> instructions to
perform. Your application can define new profiles, possibly
re-using the generic stringprep tables that always will be part of
the library, or use one of the currently supported profiles.
<p><strong>Return value:</strong> Returns <code>STRINGPREP_OK</code> iff successful, or an error code.
</p></blockquote></div>
<h4 class="subheading">stringprep_profile</h4>
<p><a name="stringprep_005fprofile"></a>
<div class="defun">
— Function: int <b>stringprep_profile</b> (<var>const char * in, char ** out, const char * profile, Stringprep_profile_flags flags</var>)<var><a name="index-stringprep_005fprofile-65"></a></var><br>
<blockquote><p><var>in</var>: input array with UTF-8 string to prepare.
<p><var>out</var>: output variable with pointer to newly allocate string.
<p><var>profile</var>: name of stringprep profile to use.
<p><var>flags</var>: a <code>Stringprep_profile_flags</code> value, or 0.
<p>Prepare the input zero terminated UTF-8 string according to the
stringprep profile, and return the result in a newly allocated
variable.
<p>Note that you must convert strings entered in the systems locale
into UTF-8 before using this function, see
<code>stringprep_locale_to_utf8()</code>.
<p>The output <code>out</code> variable must be deallocated by the caller.
<p>The <code>flags</code> are one of <code>Stringprep_profile_flags</code> values, or 0.
<p>The <code>profile</code> specifies the name of the stringprep profile to use.
It must be one of the internally supported stringprep profiles.
<p><strong>Return value:</strong> Returns <code>STRINGPREP_OK</code> iff successful, or an error code.
</p></blockquote></div>
<h3 class="section">4.5 Error Handling</h3>
<h4 class="subheading">stringprep_strerror</h4>
<p><a name="stringprep_005fstrerror"></a>
<div class="defun">
— Function: const char * <b>stringprep_strerror</b> (<var>Stringprep_rc rc</var>)<var><a name="index-stringprep_005fstrerror-66"></a></var><br>
<blockquote><p><var>rc</var>: a <code>Stringprep_rc</code> return code.
<p>Convert a return code integer to a text string. This string can be
used to output a diagnostic message to the user.
<p><strong>STRINGPREP_OK:</strong> Successful operation. This value is guaranteed to
always be zero, the remaining ones are only guaranteed to hold
non-zero values, for logical comparison purposes.
<p><strong>STRINGPREP_CONTAINS_UNASSIGNED:</strong> String contain unassigned Unicode
code points, which is forbidden by the profile.
<p><strong>STRINGPREP_CONTAINS_PROHIBITED:</strong> String contain code points
prohibited by the profile.
<p><strong>STRINGPREP_BIDI_BOTH_L_AND_RAL:</strong> String contain code points with
conflicting bidirection category.
<p><strong>STRINGPREP_BIDI_LEADTRAIL_NOT_RAL:</strong> Leading and trailing character
in string not of proper bidirectional category.
<p><strong>STRINGPREP_BIDI_CONTAINS_PROHIBITED:</strong> Contains prohibited code
points detected by bidirectional code.
<p><strong>STRINGPREP_TOO_SMALL_BUFFER:</strong> Buffer handed to function was too
small. This usually indicate a problem in the calling
application.
<p><strong>STRINGPREP_PROFILE_ERROR:</strong> The stringprep profile was inconsistent.
This usually indicate an internal error in the library.
<p><strong>STRINGPREP_FLAG_ERROR:</strong> The supplied flag conflicted with profile.
This usually indicate a problem in the calling application.
<p><strong>STRINGPREP_UNKNOWN_PROFILE:</strong> The supplied profile name was not
known to the library.
<p><strong>STRINGPREP_NFKC_FAILED:</strong> The Unicode NFKC operation failed. This
usually indicate an internal error in the library.
<p><strong>STRINGPREP_MALLOC_ERROR:</strong> The <code>malloc()</code> was out of memory. This is
usually a fatal error.
<p><strong>Return value:</strong> Returns a pointer to a statically allocated string
containing a description of the error with the return code <code>rc</code>.
</p></blockquote></div>
<h3 class="section">4.6 Stringprep Profile Macros</h3>
<div class="defun">
— Function: int <b>stringprep_nameprep_no_unassigned</b> (<var>char * in, int maxlen</var>)<var><a name="index-stringprep_005fnameprep_005fno_005funassigned-67"></a></var><br>
<blockquote>
<p><var>in</var>: input/ouput array with string to prepare.
<p><var>maxlen</var>: maximum length of input/output array.
<p>Prepare the input UTF-8 string according to the nameprep profile. The
AllowUnassigned flag is false, use <code>stringprep_nameprep</code> for
true AllowUnassigned. Returns 0 iff successful, or an error code.
</p></blockquote></div>
<div class="defun">
— Function: int <b>stringprep_iscsi</b> (<var>char * in, int maxlen</var>)<var><a name="index-stringprep_005fiscsi-68"></a></var><br>
<blockquote>
<p><var>in</var>: input/ouput array with string to prepare.
<p><var>maxlen</var>: maximum length of input/output array.
<p>Prepare the input UTF-8 string according to the draft iSCSI stringprep
profile. Returns 0 iff successful, or an error code.
</p></blockquote></div>
<div class="defun">
— Function: int <b>stringprep_plain</b> (<var>char * in, int maxlen</var>)<var><a name="index-stringprep_005fplain-69"></a></var><br>
<blockquote>
<p><var>in</var>: input/ouput array with string to prepare.
<p><var>maxlen</var>: maximum length of input/output array.
<p>Prepare the input UTF-8 string according to the draft SASL ANONYMOUS
profile. Returns 0 iff successful, or an error code.
</p></blockquote></div>
<div class="defun">
— Function: int <b>stringprep_xmpp_nodeprep</b> (<var>char * in, int maxlen</var>)<var><a name="index-stringprep_005fxmpp_005fnodeprep-70"></a></var><br>
<blockquote>
<p><var>in</var>: input/ouput array with string to prepare.
<p><var>maxlen</var>: maximum length of input/output array.
<p>Prepare the input UTF-8 string according to the draft XMPP node
identifier profile. Returns 0 iff successful, or an error code.
</p></blockquote></div>
<div class="defun">
— Function: int <b>stringprep_xmpp_resourceprep</b> (<var>char * in, int maxlen</var>)<var><a name="index-stringprep_005fxmpp_005fresourceprep-71"></a></var><br>
<blockquote>
<p><var>in</var>: input/ouput array with string to prepare.
<p><var>maxlen</var>: maximum length of input/output array.
<p>Prepare the input UTF-8 string according to the draft XMPP resource
identifier profile. Returns 0 iff successful, or an error code.
</p></blockquote></div>
<!-- ********************************************************** -->
<!-- ******************* Punycode Functions ****************** -->
<!-- ********************************************************** -->
<div class="node">
<a name="Punycode-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#IDNA-Functions">IDNA Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#Stringprep-Functions">Stringprep Functions</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">5 Punycode Functions</h2>
<p><a name="index-Punycode-Functions-72"></a>
Punycode is a simple and efficient transfer encoding syntax designed
for use with Internationalized Domain Names in Applications. It
uniquely and reversibly transforms a Unicode string into an ASCII
string. ASCII characters in the Unicode string are represented
literally, and non-ASCII characters are represented by ASCII
characters that are allowed in host name labels (letters, digits, and
hyphens). A general algorithm called Bootstring allows a string of
basic code points to uniquely represent any string of code points
drawn from a larger set. Punycode is an instance of Bootstring that
uses particular parameter values, appropriate for IDNA.
<h3 class="section">5.1 Header file <code>punycode.h</code></h3>
<p>To use the functions explained in this chapter, you need to include
the file <samp><span class="file">punycode.h</span></samp> using:
<pre class="example"> #include <punycode.h>
</pre>
<h3 class="section">5.2 Unicode Code Point Data Type</h3>
<p>The punycode function uses a special type to denote Unicode code
points. It is guaranteed to always be a 32 bit unsigned integer.
<div class="defun">
— Punycode Unicode code point: uint32_t <b>punycode_uint</b><var><a name="index-punycode_005fuint-73"></a></var><br>
<blockquote><p>A unsigned integer that hold Unicode code points.
</p></blockquote></div>
<h3 class="section">5.3 Core Functions</h3>
<p>Note that the current implementation will fail if the
<code>input_length</code> exceed 4294967295 (the size of
<code>punycode_uint</code>). This restriction may be removed in the future.
Meanwhile applications are encouraged to not depend on this problem,
and use <code>sizeof</code> to initialize <code>input_length</code> and
<code>output_length</code>.
<p>The functions provided are the following two entry points:
<h4 class="subheading">punycode_encode</h4>
<p><a name="punycode_005fencode"></a>
<div class="defun">
— Function: int <b>punycode_encode</b> (<var>size_t input_length, const punycode_uint </var>[]<var> input, const unsigned char </var>[]<var> case_flags, size_t * output_length, char </var>[]<var> output</var>)<var><a name="index-punycode_005fencode-74"></a></var><br>
<blockquote><p><var>input_length</var>: The number of code points in the <code>input</code> array and
the number of flags in the <code>case_flags</code> array.
<p><var>input</var>: An array of code points. They are presumed to be Unicode
code points, but that is not strictly REQUIRED. The array
contains code points, not code units. UTF-16 uses code units
D800 through DFFF to refer to code points 10000..10FFFF. The
code points D800..DFFF do not occur in any valid Unicode string.
The code points that can occur in Unicode strings (0..D7FF and
E000..10FFFF) are also called Unicode scalar values.
<p><var>case_flags</var>: A <code>NULL</code> pointer or an array of boolean values parallel
to the <code>input</code> array. Nonzero (true, flagged) suggests that the
corresponding Unicode character be forced to uppercase after
being decoded (if possible), and zero (false, unflagged) suggests
that it be forced to lowercase (if possible). ASCII code points
(0..7F) are encoded literally, except that ASCII letters are
forced to uppercase or lowercase according to the corresponding
case flags. If <code>case_flags</code> is a <code>NULL</code> pointer then ASCII letters
are left as they are, and other code points are treated as
unflagged.
<p><var>output_length</var>: The caller passes in the maximum number of ASCII
code points that it can receive. On successful return it will
contain the number of ASCII code points actually output.
<p><var>output</var>: An array of ASCII code points. It is *not*
null-terminated; it will contain zeros if and only if the <code>input</code>
contains zeros. (Of course the caller can leave room for a
terminator and add one if needed.)
<p>Converts a sequence of code points (presumed to be Unicode code
points) to Punycode.
<p><strong>Return value:</strong> The return value can be any of the <code>Punycode_status</code>
values defined above except <code>PUNYCODE_BAD_INPUT</code>. If not
<code>PUNYCODE_SUCCESS</code>, then <code>output_size</code> and <code>output</code> might contain
garbage.
</p></blockquote></div>
<h4 class="subheading">punycode_decode</h4>
<p><a name="punycode_005fdecode"></a>
<div class="defun">
— Function: int <b>punycode_decode</b> (<var>size_t input_length, const char </var>[]<var> input, size_t * output_length, punycode_uint </var>[]<var> output, unsigned char </var>[]<var> case_flags</var>)<var><a name="index-punycode_005fdecode-75"></a></var><br>
<blockquote><p><var>input_length</var>: The number of ASCII code points in the <code>input</code> array.
<p><var>input</var>: An array of ASCII code points (0..7F).
<p><var>output_length</var>: The caller passes in the maximum number of code
points that it can receive into the <code>output</code> array (which is also
the maximum number of flags that it can receive into the
<code>case_flags</code> array, if <code>case_flags</code> is not a <code>NULL</code> pointer). On
successful return it will contain the number of code points
actually output (which is also the number of flags actually
output, if case_flags is not a null pointer). The decoder will
never need to output more code points than the number of ASCII
code points in the input, because of the way the encoding is
defined. The number of code points output cannot exceed the
maximum possible value of a punycode_uint, even if the supplied
<code>output_length</code> is greater than that.
<p><var>output</var>: An array of code points like the input argument of
<code>punycode_encode()</code> (see above).
<p><var>case_flags</var>: A <code>NULL</code> pointer (if the flags are not needed by the
caller) or an array of boolean values parallel to the <code>output</code>
array. Nonzero (true, flagged) suggests that the corresponding
Unicode character be forced to uppercase by the caller (if
possible), and zero (false, unflagged) suggests that it be forced
to lowercase (if possible). ASCII code points (0..7F) are output
already in the proper case, but their flags will be set
appropriately so that applying the flags would be harmless.
<p>Converts Punycode to a sequence of code points (presumed to be
Unicode code points).
<p><strong>Return value:</strong> The return value can be any of the <code>Punycode_status</code>
values defined above. If not <code>PUNYCODE_SUCCESS</code>, then
<code>output_length</code>, <code>output</code>, and <code>case_flags</code> might contain garbage.
</p></blockquote></div>
<h3 class="section">5.4 Error Handling</h3>
<h4 class="subheading">punycode_strerror</h4>
<p><a name="punycode_005fstrerror"></a>
<div class="defun">
— Function: const char * <b>punycode_strerror</b> (<var>Punycode_status rc</var>)<var><a name="index-punycode_005fstrerror-76"></a></var><br>
<blockquote><p><var>rc</var>: an <code>Punycode_status</code> return code.
<p>Convert a return code integer to a text string. This string can be
used to output a diagnostic message to the user.
<p><strong>PUNYCODE_SUCCESS:</strong> Successful operation. This value is guaranteed
to always be zero, the remaining ones are only guaranteed to hold
non-zero values, for logical comparison purposes.
<p><strong>PUNYCODE_BAD_INPUT:</strong> Input is invalid.
<p><strong>PUNYCODE_BIG_OUTPUT:</strong> Output would exceed the space provided.
<p><strong>PUNYCODE_OVERFLOW:</strong> Input needs wider integers to process.
<p><strong>Return value:</strong> Returns a pointer to a statically allocated string
containing a description of the error with the return code <code>rc</code>.
</p></blockquote></div>
<!-- ********************************************************** -->
<!-- ********************* IDNA Functions ********************* -->
<!-- ********************************************************** -->
<div class="node">
<a name="IDNA-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#TLD-Functions">TLD Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#Punycode-Functions">Punycode Functions</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">6 IDNA Functions</h2>
<p><a name="index-IDNA-Functions-77"></a>
Until now, there has been no standard method for domain names to use
characters outside the ASCII repertoire. The IDNA document defines
internationalized domain names (IDNs) and a mechanism called IDNA for
handling them in a standard fashion. IDNs use characters drawn from a
large repertoire (Unicode), but IDNA allows the non-ASCII characters
to be represented using only the ASCII characters already allowed in
so-called host names today. This backward-compatible representation is
required in existing protocols like DNS, so that IDNs can be
introduced with no changes to the existing infrastructure. IDNA is
only meant for processing domain names, not free text.
<h3 class="section">6.1 Header file <code>idna.h</code></h3>
<p>To use the functions explained in this chapter, you need to include
the file <samp><span class="file">idna.h</span></samp> using:
<pre class="example"> #include <idna.h>
</pre>
<h3 class="section">6.2 Control Flags</h3>
<p>The IDNA <code>flags</code> parameter can take on the following values, or a
bit-wise inclusive or of any subset of the parameters:
<div class="defun">
— Return code: Idna_flags <b>IDNA_ALLOW_UNASSIGNED</b><var><a name="index-IDNA_005fALLOW_005fUNASSIGNED-78"></a></var><br>
<blockquote><p>Allow unassigned Unicode code points.
</p></blockquote></div>
<div class="defun">
— Return code: Idna_flags <b>IDNA_USE_STD3_ASCII_RULES</b><var><a name="index-IDNA_005fUSE_005fSTD3_005fASCII_005fRULES-79"></a></var><br>
<blockquote><p>Check output to make sure it is a STD3 conforming host name.
</p></blockquote></div>
<h3 class="section">6.3 Prefix String</h3>
<div class="defun">
— Macro: #define <b>IDNA_ACE_PREFIX</b><var><a name="index-IDNA_005fACE_005fPREFIX-80"></a></var><br>
<blockquote><p>String with the official IDNA prefix, <code>xn--</code>.
</p></blockquote></div>
<h3 class="section">6.4 Core Functions</h3>
<p>The idea behind the IDNA function names are as follows: the
<code>idna_to_ascii_4i</code> and <code>idna_to_unicode_44i</code> functions are
the core IDNA primitives. The <code>4</code> indicate that the function
takes UCS-4 strings (i.e., Unicode code points encoded in a 32-bit
unsigned integer type) of the specified length. The <code>i</code> indicate
that the data is written “inline” into the buffer. This means the
caller is responsible for allocating (and deallocating) the string,
and providing the library with the allocated length of the string.
The output length is written in the output length variable. The
remaining functions all contain the <code>z</code> indicator, which means
the strings are zero terminated. All output strings are allocated by
the library, and must be deallocated by the caller. The <code>4</code>
indicator again means that the string is UCS-4, the <code>8</code> means the
strings are UTF-8 and the <code>l</code> indicator means the strings are
encoded in the encoding used by the current locale.
<p>The functions provided are the following entry points:
<h4 class="subheading">idna_to_ascii_4i</h4>
<p><a name="idna_005fto_005fascii_005f4i"></a>
<div class="defun">
— Function: int <b>idna_to_ascii_4i</b> (<var>const uint32_t * in, size_t inlen, char * out, int flags</var>)<var><a name="index-idna_005fto_005fascii_005f4i-81"></a></var><br>
<blockquote><p><var>in</var>: input array with unicode code points.
<p><var>inlen</var>: length of input array with unicode code points.
<p><var>out</var>: output zero terminated string that must have room for at
least 63 characters plus the terminating zero.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>The ToASCII operation takes a sequence of Unicode code points that
make up one domain label and transforms it into a sequence of code
points in the ASCII range (0..7F). If ToASCII succeeds, the
original sequence and the resulting sequence are equivalent labels.
<p>It is important to note that the ToASCII operation can fail. ToASCII
fails if any step of it fails. If any step of the ToASCII operation
fails on any label in a domain name, that domain name MUST NOT be used
as an internationalized domain name. The method for deadling with this
failure is application-specific.
<p>The inputs to ToASCII are a sequence of code points, the AllowUnassigned
flag, and the UseSTD3ASCIIRules flag. The output of ToASCII is either a
sequence of ASCII code points or a failure condition.
<p>ToASCII never alters a sequence of code points that are all in the ASCII
range to begin with (although it could fail). Applying the ToASCII
operation multiple times has exactly the same effect as applying it just
once.
<p><strong>Return value:</strong> Returns 0 on success, or an <code>Idna_rc</code> error code.
</p></blockquote></div>
<h4 class="subheading">idna_to_unicode_44i</h4>
<p><a name="idna_005fto_005funicode_005f44i"></a>
<div class="defun">
— Function: int <b>idna_to_unicode_44i</b> (<var>const uint32_t * in, size_t inlen, uint32_t * out, size_t * outlen, int flags</var>)<var><a name="index-idna_005fto_005funicode_005f44i-82"></a></var><br>
<blockquote><p><var>in</var>: input array with unicode code points.
<p><var>inlen</var>: length of input array with unicode code points.
<p><var>out</var>: output array with unicode code points.
<p><var>outlen</var>: on input, maximum size of output array with unicode code points,
on exit, actual size of output array with unicode code points.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>The ToUnicode operation takes a sequence of Unicode code points
that make up one domain label and returns a sequence of Unicode
code points. If the input sequence is a label in ACE form, then the
result is an equivalent internationalized label that is not in ACE
form, otherwise the original sequence is returned unaltered.
<p>ToUnicode never fails. If any step fails, then the original input
sequence is returned immediately in that step.
<p>The Punycode decoder can never output more code points than it
inputs, but Nameprep can, and therefore ToUnicode can. Note that
the number of octets needed to represent a sequence of code points
depends on the particular character encoding used.
<p>The inputs to ToUnicode are a sequence of code points, the
AllowUnassigned flag, and the UseSTD3ASCIIRules flag. The output of
ToUnicode is always a sequence of Unicode code points.
<p><strong>Return value:</strong> Returns <code>Idna_rc</code> error condition, but it must only be
used for debugging purposes. The output buffer is always
guaranteed to contain the correct data according to the
specification (sans malloc induced errors). NB! This means that
you normally ignore the return code from this function, as
checking it means breaking the standard.
</p></blockquote></div>
<h3 class="section">6.5 Simplified ToASCII Interface</h3>
<h4 class="subheading">idna_to_ascii_4z</h4>
<p><a name="idna_005fto_005fascii_005f4z"></a>
<div class="defun">
— Function: int <b>idna_to_ascii_4z</b> (<var>const uint32_t * input, char ** output, int flags</var>)<var><a name="index-idna_005fto_005fascii_005f4z-83"></a></var><br>
<blockquote><p><var>input</var>: zero terminated input Unicode string.
<p><var>output</var>: pointer to newly allocated output string.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert UCS-4 domain name to ASCII string. The domain name may
contain several labels, separated by dots. The output buffer must
be deallocated by the caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h4 class="subheading">idna_to_ascii_8z</h4>
<p><a name="idna_005fto_005fascii_005f8z"></a>
<div class="defun">
— Function: int <b>idna_to_ascii_8z</b> (<var>const char * input, char ** output, int flags</var>)<var><a name="index-idna_005fto_005fascii_005f8z-84"></a></var><br>
<blockquote><p><var>input</var>: zero terminated input UTF-8 string.
<p><var>output</var>: pointer to newly allocated output string.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert UTF-8 domain name to ASCII string. The domain name may
contain several labels, separated by dots. The output buffer must
be deallocated by the caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h4 class="subheading">idna_to_ascii_lz</h4>
<p><a name="idna_005fto_005fascii_005flz"></a>
<div class="defun">
— Function: int <b>idna_to_ascii_lz</b> (<var>const char * input, char ** output, int flags</var>)<var><a name="index-idna_005fto_005fascii_005flz-85"></a></var><br>
<blockquote><p><var>input</var>: zero terminated input string encoded in the current locale's
character set.
<p><var>output</var>: pointer to newly allocated output string.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert domain name in the locale's encoding to ASCII string. The
domain name may contain several labels, separated by dots. The
output buffer must be deallocated by the caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h3 class="section">6.6 Simplified ToUnicode Interface</h3>
<h4 class="subheading">idna_to_unicode_4z4z</h4>
<p><a name="idna_005fto_005funicode_005f4z4z"></a>
<div class="defun">
— Function: int <b>idna_to_unicode_4z4z</b> (<var>const uint32_t * input, uint32_t ** output, int flags</var>)<var><a name="index-idna_005fto_005funicode_005f4z4z-86"></a></var><br>
<blockquote><p><var>input</var>: zero-terminated Unicode string.
<p><var>output</var>: pointer to newly allocated output Unicode string.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert possibly ACE encoded domain name in UCS-4 format into a
UCS-4 string. The domain name may contain several labels,
separated by dots. The output buffer must be deallocated by the
caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h4 class="subheading">idna_to_unicode_8z4z</h4>
<p><a name="idna_005fto_005funicode_005f8z4z"></a>
<div class="defun">
— Function: int <b>idna_to_unicode_8z4z</b> (<var>const char * input, uint32_t ** output, int flags</var>)<var><a name="index-idna_005fto_005funicode_005f8z4z-87"></a></var><br>
<blockquote><p><var>input</var>: zero-terminated UTF-8 string.
<p><var>output</var>: pointer to newly allocated output Unicode string.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert possibly ACE encoded domain name in UTF-8 format into a
UCS-4 string. The domain name may contain several labels,
separated by dots. The output buffer must be deallocated by the
caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h4 class="subheading">idna_to_unicode_8z8z</h4>
<p><a name="idna_005fto_005funicode_005f8z8z"></a>
<div class="defun">
— Function: int <b>idna_to_unicode_8z8z</b> (<var>const char * input, char ** output, int flags</var>)<var><a name="index-idna_005fto_005funicode_005f8z8z-88"></a></var><br>
<blockquote><p><var>input</var>: zero-terminated UTF-8 string.
<p><var>output</var>: pointer to newly allocated output UTF-8 string.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert possibly ACE encoded domain name in UTF-8 format into a
UTF-8 string. The domain name may contain several labels,
separated by dots. The output buffer must be deallocated by the
caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h4 class="subheading">idna_to_unicode_8zlz</h4>
<p><a name="idna_005fto_005funicode_005f8zlz"></a>
<div class="defun">
— Function: int <b>idna_to_unicode_8zlz</b> (<var>const char * input, char ** output, int flags</var>)<var><a name="index-idna_005fto_005funicode_005f8zlz-89"></a></var><br>
<blockquote><p><var>input</var>: zero-terminated UTF-8 string.
<p><var>output</var>: pointer to newly allocated output string encoded in the
current locale's character set.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert possibly ACE encoded domain name in UTF-8 format into a
string encoded in the current locale's character set. The domain
name may contain several labels, separated by dots. The output
buffer must be deallocated by the caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h4 class="subheading">idna_to_unicode_lzlz</h4>
<p><a name="idna_005fto_005funicode_005flzlz"></a>
<div class="defun">
— Function: int <b>idna_to_unicode_lzlz</b> (<var>const char * input, char ** output, int flags</var>)<var><a name="index-idna_005fto_005funicode_005flzlz-90"></a></var><br>
<blockquote><p><var>input</var>: zero-terminated string encoded in the current locale's
character set.
<p><var>output</var>: pointer to newly allocated output string encoded in the
current locale's character set.
<p><var>flags</var>: an <code>Idna_flags</code> value, e.g., <code>IDNA_ALLOW_UNASSIGNED</code> or
<code>IDNA_USE_STD3_ASCII_RULES</code>.
<p>Convert possibly ACE encoded domain name in the locale's character
set into a string encoded in the current locale's character set.
The domain name may contain several labels, separated by dots. The
output buffer must be deallocated by the caller.
<p><strong>Return value:</strong> Returns <code>IDNA_SUCCESS</code> on success, or error code.
</p></blockquote></div>
<h3 class="section">6.7 Error Handling</h3>
<h4 class="subheading">idna_strerror</h4>
<p><a name="idna_005fstrerror"></a>
<div class="defun">
— Function: const char * <b>idna_strerror</b> (<var>Idna_rc rc</var>)<var><a name="index-idna_005fstrerror-91"></a></var><br>
<blockquote><p><var>rc</var>: an <code>Idna_rc</code> return code.
<p>Convert a return code integer to a text string. This string can be
used to output a diagnostic message to the user.
<p><strong>IDNA_SUCCESS:</strong> Successful operation. This value is guaranteed to
always be zero, the remaining ones are only guaranteed to hold
non-zero values, for logical comparison purposes.
<p><strong>IDNA_STRINGPREP_ERROR:</strong> Error during string preparation.
<p><strong>IDNA_PUNYCODE_ERROR:</strong> Error during punycode operation.
<p><strong>IDNA_CONTAINS_NON_LDH:</strong> For IDNA_USE_STD3_ASCII_RULES, indicate that
the string contains non-LDH ASCII characters.
<p><strong>IDNA_CONTAINS_MINUS:</strong> For IDNA_USE_STD3_ASCII_RULES, indicate that
the string contains a leading or trailing hyphen-minus (U+002D).
<p><strong>IDNA_INVALID_LENGTH:</strong> The final output string is not within the
(inclusive) range 1 to 63 characters.
<p><strong>IDNA_NO_ACE_PREFIX:</strong> The string does not contain the ACE prefix
(for ToUnicode).
<p><strong>IDNA_ROUNDTRIP_VERIFY_ERROR:</strong> The ToASCII operation on output
string does not equal the input.
<p><strong>IDNA_CONTAINS_ACE_PREFIX:</strong> The input contains the ACE prefix (for
ToASCII).
<p><strong>IDNA_ICONV_ERROR:</strong> Could not convert string in locale encoding.
<p><strong>IDNA_MALLOC_ERROR:</strong> Could not allocate buffer (this is typically a
fatal error).
<p><strong>IDNA_DLOPEN_ERROR:</strong> Could not dlopen the libcidn DSO (only used
internally in libc).
<p><strong>Return value:</strong> Returns a pointer to a statically allocated string
containing a description of the error with the return code <code>rc</code>.
</p></blockquote></div>
<!-- ********************************************************** -->
<!-- ********************** TLD Functions ********************* -->
<!-- ********************************************************** -->
<div class="node">
<a name="TLD-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#PR29-Functions">PR29 Functions</a>,
Previous: <a rel="previous" accesskey="p" href="#IDNA-Functions">IDNA Functions</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">7 TLD Functions</h2>
<p><a name="index-TLD-Functions-92"></a>
Organizations that manage some Top Level Domains (<acronym>TLD</acronym>s) have
published tables with characters they accept within the domain. The
reason may be to reduce complexity that come from using the full
Unicode range, and to protect themselves from future (backwards
incompatible) changes in the IDN or Unicode specifications. Libidn
implement an infrastructure for defining and checking strings against
such tables. Libidn also ship some tables from <acronym>TLD</acronym>s that we
have managed to get permission to use them from. Because these tables
are even less static than Unicode or StringPrep tables, it is likely
that they will be updated from time to time (even in backwards
incompatibe ways). The Libidn interface provide a “version” field
for each <acronym>TLD</acronym> table, which can be compared for equality to
guarantee the same operation over time.
<p>From a design point of view, you can regard the <acronym>TLD</acronym> tables
for IDN as the “localization” step that come after the
“internationalization” step provided by the IETF standards.
<p>The TLD functionality rely on up-to-date tables. The latest version
of Libidn aim to provide these, but tables with unclear copying
conditions, or generally experimental tables, are not included. Some
such tables can be found at <a href="http://tldchk.berlios.de">http://tldchk.berlios.de</a>.
<h3 class="section">7.1 Header file <code>tld.h</code></h3>
<p>To use the functions explained in this chapter, you need to include
the file <samp><span class="file">tld.h</span></samp> using:
<pre class="example"> #include <tld.h>
</pre>
<!-- @section Data Types -->
<!-- @deftp {Data type} {Tld_table_element} @var{start} @var{end} -->
<!-- @example -->
<!-- /* Interval of valid code points in the TLD. */ -->
<!-- struct Tld_table_element -->
<!-- @{ -->
<!-- uint32_t start; /* Start of range. */ -->
<!-- uint32_t end; /* End of range, end == start if single. */ -->
<!-- @}; -->
<!-- typedef struct Tld_table_element Tld_table_element; -->
<!-- @end example -->
<!-- This @code{struct} contain the @var{start} and @var{end} positions -->
<!-- (inclusive) of a range. If the range is a single (i.e., starts and -->
<!-- ends in the same character), then set @var{end} to the same as -->
<!-- @var{start}. This structure is normally used as an array. -->
<!-- @end deftp -->
<!-- @deftp {Data type} {Tld_table} @var{name} @var{version} @var{nvalid} @var{valid} -->
<!-- @example -->
<!-- /* List valid code points in a TLD. */ -->
<!-- struct Tld_table -->
<!-- @{ -->
<!-- char *name; /* TLD name, e.g., "no". */ -->
<!-- char *version; /* Version string from TLD file. */ -->
<!-- size_t nvalid; /* Number of entries in data. */ -->
<!-- Tld_table_element *valid[]; /* Sorted array of valid code points. */ -->
<!-- @}; -->
<!-- typedef struct Tld_table Tld_table; -->
<!-- @end example -->
<!-- In this @code{struct}, the @var{name} field is a string (@samp{char*}) -->
<!-- indicating the TLD name (e.g., ``no''). The @var{version} field is a -->
<!-- string (@samp{char*}) containing a free form humanly readable string -->
<!-- that can be used for equality comparison to compare different versions -->
<!-- of the table. The @var{nvalid} field indicate how many entries there -->
<!-- are in @var{valid}, which brings us finally to @var{valid} that -->
<!-- contain the actual code points that are valid for this TLD (see -->
<!-- @code{Tld_table_element} above). -->
<!-- @end deftp -->
<h3 class="section">7.2 Core Functions</h3>
<h4 class="subheading">tld_check_4t</h4>
<p><a name="tld_005fcheck_005f4t"></a>
<div class="defun">
— Function: int <b>tld_check_4t</b> (<var>const uint32_t * in, size_t inlen, size_t * errpos, const Tld_table * tld</var>)<var><a name="index-tld_005fcheck_005f4t-93"></a></var><br>
<blockquote><p><var>in</var>: Array of unicode code points to process. Does not need to be
zero terminated.
<p><var>inlen</var>: Number of unicode code points.
<p><var>errpos</var>: Position of offending character is returned here.
<p><var>tld</var>: A <code>Tld_table</code> data structure representing the restrictions for
which the input should be tested.
<p>Test each of the code points in <code>in</code> for whether or not
they are allowed by the data structure in <code>tld</code>, return
the position of the first character for which this is not
the case in <code>errpos</code>.
<p><strong>Return value:</strong> Returns the <code>Tld_rc</code> value <code>TLD_SUCCESS</code> if all code
points are valid or when <code>tld</code> is null, <code>TLD_INVALID</code> if a
character is not allowed, or additional error codes on general
failure conditions.
</p></blockquote></div>
<h4 class="subheading">tld_check_4tz</h4>
<p><a name="tld_005fcheck_005f4tz"></a>
<div class="defun">
— Function: int <b>tld_check_4tz</b> (<var>const uint32_t * in, size_t * errpos, const Tld_table * tld</var>)<var><a name="index-tld_005fcheck_005f4tz-94"></a></var><br>
<blockquote><p><var>in</var>: Zero terminated array of unicode code points to process.
<p><var>errpos</var>: Position of offending character is returned here.
<p><var>tld</var>: A <code>Tld_table</code> data structure representing the restrictions for
which the input should be tested.
<p>Test each of the code points in <code>in</code> for whether or not
they are allowed by the data structure in <code>tld</code>, return
the position of the first character for which this is not
the case in <code>errpos</code>.
<p><strong>Return value:</strong> Returns the <code>Tld_rc</code> value <code>TLD_SUCCESS</code> if all code
points are valid or when <code>tld</code> is null, <code>TLD_INVALID</code> if a
character is not allowed, or additional error codes on general
failure conditions.
</p></blockquote></div>
<h3 class="section">7.3 Utility Functions</h3>
<h4 class="subheading">tld_get_4</h4>
<p><a name="tld_005fget_005f4"></a>
<div class="defun">
— Function: int <b>tld_get_4</b> (<var>const uint32_t * in, size_t inlen, char ** out</var>)<var><a name="index-tld_005fget_005f4-95"></a></var><br>
<blockquote><p><var>in</var>: Array of unicode code points to process. Does not need to be
zero terminated.
<p><var>inlen</var>: Number of unicode code points.
<p><var>out</var>: Zero terminated ascii result string pointer.
<p>Isolate the top-level domain of <code>in</code> and return it as an ASCII
string in <code>out</code>.
<p><strong>Return value:</strong> Return <code>TLD_SUCCESS</code> on success, or the corresponding
<code>Tld_rc</code> error code otherwise.
</p></blockquote></div>
<h4 class="subheading">tld_get_4z</h4>
<p><a name="tld_005fget_005f4z"></a>
<div class="defun">
— Function: int <b>tld_get_4z</b> (<var>const uint32_t * in, char ** out</var>)<var><a name="index-tld_005fget_005f4z-96"></a></var><br>
<blockquote><p><var>in</var>: Zero terminated array of unicode code points to process.
<p><var>out</var>: Zero terminated ascii result string pointer.
<p>Isolate the top-level domain of <code>in</code> and return it as an ASCII
string in <code>out</code>.
<p><strong>Return value:</strong> Return <code>TLD_SUCCESS</code> on success, or the corresponding
<code>Tld_rc</code> error code otherwise.
</p></blockquote></div>
<h4 class="subheading">tld_get_z</h4>
<p><a name="tld_005fget_005fz"></a>
<div class="defun">
— Function: int <b>tld_get_z</b> (<var>const char * in, char ** out</var>)<var><a name="index-tld_005fget_005fz-97"></a></var><br>
<blockquote><p><var>in</var>: Zero terminated character array to process.
<p><var>out</var>: Zero terminated ascii result string pointer.
<p>Isolate the top-level domain of <code>in</code> and return it as an ASCII
string in <code>out</code>. The input string <code>in</code> may be UTF-8, ISO-8859-1 or
any ASCII compatible character encoding.
<p><strong>Return value:</strong> Return <code>TLD_SUCCESS</code> on success, or the corresponding
<code>Tld_rc</code> error code otherwise.
</p></blockquote></div>
<h4 class="subheading">tld_get_table</h4>
<p><a name="tld_005fget_005ftable"></a>
<div class="defun">
— Function: const Tld_table * <b>tld_get_table</b> (<var>const char * tld, const Tld_table ** tables</var>)<var><a name="index-tld_005fget_005ftable-98"></a></var><br>
<blockquote><p><var>tld</var>: TLD name (e.g. "com") as zero terminated ASCII byte string.
<p><var>tables</var>: Zero terminated array of <code>Tld_table</code> info-structures for
TLDs.
<p>Get the TLD table for a named TLD by searching through the given
TLD table array.
<p><strong>Return value:</strong> Return structure corresponding to TLD <code>tld</code> by going
thru <code>tables</code>, or return <code>NULL</code> if no such structure is found.
</p></blockquote></div>
<h4 class="subheading">tld_default_table</h4>
<p><a name="tld_005fdefault_005ftable"></a>
<div class="defun">
— Function: const Tld_table * <b>tld_default_table</b> (<var>const char * tld, const Tld_table ** overrides</var>)<var><a name="index-tld_005fdefault_005ftable-99"></a></var><br>
<blockquote><p><var>tld</var>: TLD name (e.g. "com") as zero terminated ASCII byte string.
<p><var>overrides</var>: Additional zero terminated array of <code>Tld_table</code>
info-structures for TLDs, or <code>NULL</code> to only use library deault
tables.
<p>Get the TLD table for a named TLD, using the internal defaults,
possibly overrided by the (optional) supplied tables.
<p><strong>Return value:</strong> Return structure corresponding to TLD <code>tld_str</code>, first
looking through <code>overrides</code> then thru built-in list, or <code>NULL</code> if
no such structure found.
</p></blockquote></div>
<h3 class="section">7.4 High-Level Wrapper Functions</h3>
<h4 class="subheading">tld_check_4</h4>
<p><a name="tld_005fcheck_005f4"></a>
<div class="defun">
— Function: int <b>tld_check_4</b> (<var>const uint32_t * in, size_t inlen, size_t * errpos, const Tld_table ** overrides</var>)<var><a name="index-tld_005fcheck_005f4-100"></a></var><br>
<blockquote><p><var>in</var>: Array of unicode code points to process. Does not need to be
zero terminated.
<p><var>inlen</var>: Number of unicode code points.
<p><var>errpos</var>: Position of offending character is returned here.
<p><var>overrides</var>: A <code>Tld_table</code> array of additional domain restriction
structures that complement and supersede the built-in information.
<p>Test each of the code points in <code>in</code> for whether or not they are
allowed by the information in <code>overrides</code> or by the built-in TLD
restriction data. When data for the same TLD is available both
internally and in <code>overrides</code>, the information in <code>overrides</code> takes
precedence. If several entries for a specific TLD are found, the
first one is used. If <code>overrides</code> is <code>NULL</code>, only the built-in
information is used. The position of the first offending character
is returned in <code>errpos</code>.
<p><strong>Return value:</strong> Returns the <code>Tld_rc</code> value <code>TLD_SUCCESS</code> if all code
points are valid or when <code>tld</code> is null, <code>TLD_INVALID</code> if a
character is not allowed, or additional error codes on general
failure conditions.
</p></blockquote></div>
<h4 class="subheading">tld_check_4z</h4>
<p><a name="tld_005fcheck_005f4z"></a>
<div class="defun">
— Function: int <b>tld_check_4z</b> (<var>const uint32_t * in, size_t * errpos, const Tld_table ** overrides</var>)<var><a name="index-tld_005fcheck_005f4z-101"></a></var><br>
<blockquote><p><var>in</var>: Zero-terminated array of unicode code points to process.
<p><var>errpos</var>: Position of offending character is returned here.
<p><var>overrides</var>: A <code>Tld_table</code> array of additional domain restriction
structures that complement and supersede the built-in information.
<p>Test each of the code points in <code>in</code> for whether or not they are
allowed by the information in <code>overrides</code> or by the built-in TLD
restriction data. When data for the same TLD is available both
internally and in <code>overrides</code>, the information in <code>overrides</code> takes
precedence. If several entries for a specific TLD are found, the
first one is used. If <code>overrides</code> is <code>NULL</code>, only the built-in
information is used. The position of the first offending character
is returned in <code>errpos</code>.
<p><strong>Return value:</strong> Returns the <code>Tld_rc</code> value <code>TLD_SUCCESS</code> if all code
points are valid or when <code>tld</code> is null, <code>TLD_INVALID</code> if a
character is not allowed, or additional error codes on general
failure conditions.
</p></blockquote></div>
<h4 class="subheading">tld_check_8z</h4>
<p><a name="tld_005fcheck_005f8z"></a>
<div class="defun">
— Function: int <b>tld_check_8z</b> (<var>const char * in, size_t * errpos, const Tld_table ** overrides</var>)<var><a name="index-tld_005fcheck_005f8z-102"></a></var><br>
<blockquote><p><var>in</var>: Zero-terminated UTF8 string to process.
<p><var>errpos</var>: Position of offending character is returned here.
<p><var>overrides</var>: A <code>Tld_table</code> array of additional domain restriction
structures that complement and supersede the built-in information.
<p>Test each of the characters in <code>in</code> for whether or not they are
allowed by the information in <code>overrides</code> or by the built-in TLD
restriction data. When data for the same TLD is available both
internally and in <code>overrides</code>, the information in <code>overrides</code> takes
precedence. If several entries for a specific TLD are found, the
first one is used. If <code>overrides</code> is <code>NULL</code>, only the built-in
information is used. The position of the first offending character
is returned in <code>errpos</code>. Note that the error position refers to the
decoded character offset rather than the byte position in the
string.
<p><strong>Return value:</strong> Returns the <code>Tld_rc</code> value <code>TLD_SUCCESS</code> if all
characters are valid or when <code>tld</code> is null, <code>TLD_INVALID</code> if a
character is not allowed, or additional error codes on general
failure conditions.
</p></blockquote></div>
<h4 class="subheading">tld_check_lz</h4>
<p><a name="tld_005fcheck_005flz"></a>
<div class="defun">
— Function: int <b>tld_check_lz</b> (<var>const char * in, size_t * errpos, const Tld_table ** overrides</var>)<var><a name="index-tld_005fcheck_005flz-103"></a></var><br>
<blockquote><p><var>in</var>: Zero-terminated string in the current locales encoding to process.
<p><var>errpos</var>: Position of offending character is returned here.
<p><var>overrides</var>: A <code>Tld_table</code> array of additional domain restriction
structures that complement and supersede the built-in information.
<p>Test each of the characters in <code>in</code> for whether or not they are
allowed by the information in <code>overrides</code> or by the built-in TLD
restriction data. When data for the same TLD is available both
internally and in <code>overrides</code>, the information in <code>overrides</code> takes
precedence. If several entries for a specific TLD are found, the
first one is used. If <code>overrides</code> is <code>NULL</code>, only the built-in
information is used. The position of the first offending character
is returned in <code>errpos</code>. Note that the error position refers to the
decoded character offset rather than the byte position in the
string.
<p><strong>Return value:</strong> Returns the <code>Tld_rc</code> value <code>TLD_SUCCESS</code> if all
characters are valid or when <code>tld</code> is null, <code>TLD_INVALID</code> if a
character is not allowed, or additional error codes on general
failure conditions.
</p></blockquote></div>
<h3 class="section">7.5 Error Handling</h3>
<h4 class="subheading">tld_strerror</h4>
<p><a name="tld_005fstrerror"></a>
<div class="defun">
— Function: const char * <b>tld_strerror</b> (<var>Tld_rc rc</var>)<var><a name="index-tld_005fstrerror-104"></a></var><br>
<blockquote><p><var>rc</var>: tld return code
<p>Convert a return code integer to a text string. This string can be
used to output a diagnostic message to the user.
<p><strong>TLD_SUCCESS:</strong> Successful operation. This value is guaranteed to
always be zero, the remaining ones are only guaranteed to hold
non-zero values, for logical comparison purposes.
<p><strong>TLD_INVALID:</strong> Invalid character found.
<p><strong>TLD_NODATA:</strong> No input data was provided.
<p><strong>TLD_MALLOC_ERROR:</strong> Error during memory allocation.
<p><strong>TLD_ICONV_ERROR:</strong> Error during iconv string conversion.
<p><strong>TLD_NO_TLD:</strong> No top-level domain found in domain string.
<p><strong>Return value:</strong> Returns a pointer to a statically allocated string
containing a description of the error with the return code <code>rc</code>.
</p></blockquote></div>
<!-- ********************************************************** -->
<!-- ********************** PR29 Functions ******************** -->
<!-- ********************************************************** -->
<div class="node">
<a name="PR29-Functions"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Examples">Examples</a>,
Previous: <a rel="previous" accesskey="p" href="#TLD-Functions">TLD Functions</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">8 PR29 Functions</h2>
<p><a name="index-PR29-Functions-105"></a>
A deficiency in the specification of Unicode Normalization Forms has
been found. The consequence is that some strings can be normalized
into different strings by different implementations. In other words,
two different implementations may return different output for the same
input (because the interpretation of the specification is
ambiguous). Further, an implementation invoked again on the one of the
output strings may return a different string (because one of the
interpretation of the ambiguous specification make normalization
non-idempotent). Fortunately, only a select few character sequence
exhibit this problem, and none of them are expected to occur in
natural languages (due to different linguistic uses of the involved
characters).
<p>A full discussion of the problem may be found at:
<p><a href="http://www.unicode.org/review/pr-29.html">http://www.unicode.org/review/pr-29.html</a>
<p>The PR29 functions below allow you to detect the problem sequence. So
when would you want to use these functions? For most applications,
such as those using Nameprep for IDN, this is likely only to be an
interoperability problem. Thus, you may not want to care about it, as
the character sequences will rarely occur naturally. However, if you
are using a profile, such as SASLPrep, to process authentication
tokens; authorization tokens; or passwords, there is a real danger
that attackers may try to use the peculiarities in these strings to
attack parts of your system. As only a small number of strings, and
no naturally occurring strings, exhibit this problem, the conservative
approach of rejecting the strings is recommended. If this approach is
not used, you should instead verify that all parts of your system,
that process the tokens and passwords, use a NFKC implementation that
produce the same output for the same input.
<p>Technically inclined readers may be interested in knowing more about
the implementation aspects of the PR29 flaw. See <a href="#PR29-discussion">PR29 discussion</a>.
<h3 class="section">8.1 Header file <code>pr29.h</code></h3>
<p>To use the functions explained in this chapter, you need to include
the file <samp><span class="file">pr29.h</span></samp> using:
<pre class="example"> #include <pr29.h>
</pre>
<h3 class="section">8.2 Core Functions</h3>
<h4 class="subheading">pr29_4</h4>
<p><a name="pr29_005f4"></a>
<div class="defun">
— Function: int <b>pr29_4</b> (<var>const uint32_t * in, size_t len</var>)<var><a name="index-pr29_005f4-106"></a></var><br>
<blockquote><p><var>in</var>: input array with unicode code points.
<p><var>len</var>: length of input array with unicode code points.
<p>Check the input to see if it may be normalized into different
strings by different NFKC implementations, due to an anomaly in the
NFKC specifications.
<p><strong>Return value:</strong> Returns the <code>Pr29_rc</code> value <code>PR29_SUCCESS</code> on success,
and <code>PR29_PROBLEM</code> if the input sequence is a "problem sequence"
(i.e., may be normalized into different strings by different
implementations).
</p></blockquote></div>
<h3 class="section">8.3 Utility Functions</h3>
<h4 class="subheading">pr29_4z</h4>
<p><a name="pr29_005f4z"></a>
<div class="defun">
— Function: int <b>pr29_4z</b> (<var>const uint32_t * in</var>)<var><a name="index-pr29_005f4z-107"></a></var><br>
<blockquote><p><var>in</var>: zero terminated array of Unicode code points.
<p>Check the input to see if it may be normalized into different
strings by different NFKC implementations, due to an anomaly in the
NFKC specifications.
<p><strong>Return value:</strong> Returns the <code>Pr29_rc</code> value <code>PR29_SUCCESS</code> on success,
and <code>PR29_PROBLEM</code> if the input sequence is a "problem sequence"
(i.e., may be normalized into different strings by different
implementations).
</p></blockquote></div>
<h4 class="subheading">pr29_8z</h4>
<p><a name="pr29_005f8z"></a>
<div class="defun">
— Function: int <b>pr29_8z</b> (<var>const char * in</var>)<var><a name="index-pr29_005f8z-108"></a></var><br>
<blockquote><p><var>in</var>: zero terminated input UTF-8 string.
<p>Check the input to see if it may be normalized into different
strings by different NFKC implementations, due to an anomaly in the
NFKC specifications.
<p><strong>Return value:</strong> Returns the <code>Pr29_rc</code> value <code>PR29_SUCCESS</code> on success,
and <code>PR29_PROBLEM</code> if the input sequence is a "problem sequence"
(i.e., may be normalized into different strings by different
implementations), or <code>PR29_STRINGPREP_ERROR</code> if there was a
problem converting the string from UTF-8 to UCS-4.
</p></blockquote></div>
<h3 class="section">8.4 Error Handling</h3>
<h4 class="subheading">pr29_strerror</h4>
<p><a name="pr29_005fstrerror"></a>
<div class="defun">
— Function: const char * <b>pr29_strerror</b> (<var>Pr29_rc rc</var>)<var><a name="index-pr29_005fstrerror-109"></a></var><br>
<blockquote><p><var>rc</var>: an <code>Pr29_rc</code> return code.
<p>Convert a return code integer to a text string. This string can be
used to output a diagnostic message to the user.
<p><strong>PR29_SUCCESS:</strong> Successful operation. This value is guaranteed to
always be zero, the remaining ones are only guaranteed to hold
non-zero values, for logical comparison purposes.
<p><strong>PR29_PROBLEM:</strong> A problem sequence was encountered.
<p><strong>PR29_STRINGPREP_ERROR:</strong> The character set conversion failed (only
for <code>pr29_8()</code> and <code>pr29_8z()</code>).
<p><strong>Return value:</strong> Returns a pointer to a statically allocated string
containing a description of the error with the return code <code>rc</code>.
</p></blockquote></div>
<!-- ********************************************************** -->
<!-- *********************** Examples *********************** -->
<!-- ********************************************************** -->
<div class="node">
<a name="Examples"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Invoking-idn">Invoking idn</a>,
Previous: <a rel="previous" accesskey="p" href="#PR29-Functions">PR29 Functions</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">9 Examples</h2>
<p><a name="index-Examples-110"></a>
This chapter contains example code which illustrate how `Libidn' can
be used when writing your own application.
<ul class="menu">
<li><a accesskey="1" href="#Example-1">Example 1</a>: Example using stringprep.
<li><a accesskey="2" href="#Example-2">Example 2</a>: Example using punycode.
<li><a accesskey="3" href="#Example-3">Example 3</a>: Example using IDNA ToASCII.
<li><a accesskey="4" href="#Example-4">Example 4</a>: Example using IDNA ToUnicode.
<li><a accesskey="5" href="#Example-5">Example 5</a>: Example using TLD checking.
</ul>
<div class="node">
<a name="Example-1"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Example-2">Example 2</a>,
Up: <a rel="up" accesskey="u" href="#Examples">Examples</a>
</div>
<h3 class="section">9.1 Example 1</h3>
<p>This example demonstrates how the stringprep functions are used.
<pre class="verbatim">/* example.c --- Example code showing how to use stringprep().
* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Simon Josefsson
*
* This file is part of GNU Libidn.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h> /* setlocale() */
#include <stringprep.h>
/*
* Compiling using libtool and pkg-config is recommended:
*
* $ libtool cc -o example example.c `pkg-config --cflags --libs libidn`
* $ ./example
* Input string encoded as `ISO-8859-1': ª
* Before locale2utf8 (length 2): aa 0a
* Before stringprep (length 3): c2 aa 0a
* After stringprep (length 2): 61 0a
* $
*
*/
int
main (void)
{
char buf[BUFSIZ];
char *p;
int rc;
size_t i;
setlocale (LC_ALL, "");
printf ("Input string encoded as `%s': ", stringprep_locale_charset ());
fflush (stdout);
fgets (buf, BUFSIZ, stdin);
printf ("Before locale2utf8 (length %d): ", strlen (buf));
for (i = 0; i < strlen (buf); i++)
printf ("%02x ", buf[i] & 0xFF);
printf ("\n");
p = stringprep_locale_to_utf8 (buf);
if (p)
{
strcpy (buf, p);
free (p);
}
else
printf ("Could not convert string to UTF-8, continuing anyway...\n");
printf ("Before stringprep (length %d): ", strlen (buf));
for (i = 0; i < strlen (buf); i++)
printf ("%02x ", buf[i] & 0xFF);
printf ("\n");
rc = stringprep (buf, BUFSIZ, 0, stringprep_nameprep);
if (rc != STRINGPREP_OK)
printf ("Stringprep failed (%d): %s\n", rc, stringprep_strerror (rc));
else
{
printf ("After stringprep (length %d): ", strlen (buf));
for (i = 0; i < strlen (buf); i++)
printf ("%02x ", buf[i] & 0xFF);
printf ("\n");
}
return 0;
}
</pre>
<div class="node">
<a name="Example-2"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Example-3">Example 3</a>,
Previous: <a rel="previous" accesskey="p" href="#Example-1">Example 1</a>,
Up: <a rel="up" accesskey="u" href="#Examples">Examples</a>
</div>
<h3 class="section">9.2 Example 2</h3>
<p>This example demonstrates how the punycode functions are used.
<pre class="verbatim">/* example2.c --- Example code showing how to use punycode.
* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Simon Josefsson
* Copyright (C) 2002 Adam M. Costello
*
* This file is part of GNU Libidn.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <locale.h> /* setlocale() */
/*
* This file is derived from RFC 3492 written by Adam M. Costello.
*
* Disclaimer and license: Regarding this entire document or any
* portion of it (including the pseudocode and C code), the author
* makes no guarantees and is not responsible for any damage resulting
* from its use. The author grants irrevocable permission to anyone
* to use, modify, and distribute it in any way that does not diminish
* the rights of anyone else to use, modify, and distribute it,
* provided that redistributed derivative works do not contain
* misleading author or version information. Derivative works need
* not be licensed under similar terms.
*
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <punycode.h>
/* For testing, we'll just set some compile-time limits rather than */
/* use malloc(), and set a compile-time option rather than using a */
/* command-line option. */
enum
{
unicode_max_length = 256,
ace_max_length = 256
};
static void
usage (char **argv)
{
fprintf (stderr,
"\n"
"%s -e reads code points and writes a Punycode string.\n"
"%s -d reads a Punycode string and writes code points.\n"
"\n"
"Input and output are plain text in the native character set.\n"
"Code points are in the form u+hex separated by whitespace.\n"
"Although the specification allows Punycode strings to contain\n"
"any characters from the ASCII repertoire, this test code\n"
"supports only the printable characters, and needs the Punycode\n"
"string to be followed by a newline.\n"
"The case of the u in u+hex is the force-to-uppercase flag.\n",
argv[0], argv[0]);
exit (EXIT_FAILURE);
}
static void
fail (const char *msg)
{
fputs (msg, stderr);
exit (EXIT_FAILURE);
}
static const char too_big[] =
"input or output is too large, recompile with larger limits\n";
static const char invalid_input[] = "invalid input\n";
static const char overflow[] = "arithmetic overflow\n";
static const char io_error[] = "I/O error\n";
/* The following string is used to convert printable */
/* characters between ASCII and the native charset: */
static const char print_ascii[] = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" " !\"#$%&'()*+,-./" "0123456789:;<=>?" "\0x40" /* at sign */
"ABCDEFGHIJKLMNO"
"PQRSTUVWXYZ[\\]^_" "`abcdefghijklmno" "pqrstuvwxyz{|}~\n";
int
main (int argc, char **argv)
{
enum punycode_status status;
int r;
size_t input_length, output_length, j;
unsigned char case_flags[unicode_max_length];
setlocale (LC_ALL, "");
if (argc != 2)
usage (argv);
if (argv[1][0] != '-')
usage (argv);
if (argv[1][2] != 0)
usage (argv);
if (argv[1][1] == 'e')
{
uint32_t input[unicode_max_length];
unsigned long codept;
char output[ace_max_length + 1], uplus[3];
int c;
/* Read the input code points: */
input_length = 0;
for (;;)
{
r = scanf ("%2s%lx", uplus, &codept);
if (ferror (stdin))
fail (io_error);
if (r == EOF || r == 0)
break;
if (r != 2 || uplus[1] != '+' || codept > (uint32_t) - 1)
{
fail (invalid_input);
}
if (input_length == unicode_max_length)
fail (too_big);
if (uplus[0] == 'u')
case_flags[input_length] = 0;
else if (uplus[0] == 'U')
case_flags[input_length] = 1;
else
fail (invalid_input);
input[input_length++] = codept;
}
/* Encode: */
output_length = ace_max_length;
status = punycode_encode (input_length, input, case_flags,
&output_length, output);
if (status == punycode_bad_input)
fail (invalid_input);
if (status == punycode_big_output)
fail (too_big);
if (status == punycode_overflow)
fail (overflow);
assert (status == punycode_success);
/* Convert to native charset and output: */
for (j = 0; j < output_length; ++j)
{
c = output[j];
assert (c >= 0 && c <= 127);
if (print_ascii[c] == 0)
fail (invalid_input);
output[j] = print_ascii[c];
}
output[j] = 0;
r = puts (output);
if (r == EOF)
fail (io_error);
return EXIT_SUCCESS;
}
if (argv[1][1] == 'd')
{
char input[ace_max_length + 2], *p, *pp;
uint32_t output[unicode_max_length];
/* Read the Punycode input string and convert to ASCII: */
fgets (input, ace_max_length + 2, stdin);
if (ferror (stdin))
fail (io_error);
if (feof (stdin))
fail (invalid_input);
input_length = strlen (input) - 1;
if (input[input_length] != '\n')
fail (too_big);
input[input_length] = 0;
for (p = input; *p != 0; ++p)
{
pp = strchr (print_ascii, *p);
if (pp == 0)
fail (invalid_input);
*p = pp - print_ascii;
}
/* Decode: */
output_length = unicode_max_length;
status = punycode_decode (input_length, input, &output_length,
output, case_flags);
if (status == punycode_bad_input)
fail (invalid_input);
if (status == punycode_big_output)
fail (too_big);
if (status == punycode_overflow)
fail (overflow);
assert (status == punycode_success);
/* Output the result: */
for (j = 0; j < output_length; ++j)
{
r = printf ("%s+%04lX\n",
case_flags[j] ? "U" : "u", (unsigned long) output[j]);
if (r < 0)
fail (io_error);
}
return EXIT_SUCCESS;
}
usage (argv);
return EXIT_SUCCESS; /* not reached, but quiets compiler warning */
}
</pre>
<div class="node">
<a name="Example-3"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Example-4">Example 4</a>,
Previous: <a rel="previous" accesskey="p" href="#Example-2">Example 2</a>,
Up: <a rel="up" accesskey="u" href="#Examples">Examples</a>
</div>
<h3 class="section">9.3 Example 3</h3>
<p>This example demonstrates how the library is used to convert
internationalized domain names into ASCII compatible names.
<pre class="verbatim">/* example3.c --- Example ToASCII() code showing how to use Libidn.
* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Simon Josefsson
*
* This file is part of GNU Libidn.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h> /* setlocale() */
#include <stringprep.h> /* stringprep_locale_charset() */
#include <idna.h> /* idna_to_ascii_lz() */
/*
* Compiling using libtool and pkg-config is recommended:
*
* $ libtool cc -o example3 example3.c `pkg-config --cflags --libs libidn`
* $ ./example3
* Input domain encoded as `ISO-8859-1': www.räksmörgåsª.example
* Read string (length 23): 77 77 77 2e 72 e4 6b 73 6d f6 72 67 e5 73 aa 2e 65 78 61 6d 70 6c 65
* ACE label (length 33): 'www.xn--rksmrgsa-0zap8p.example'
* 77 77 77 2e 78 6e 2d 2d 72 6b 73 6d 72 67 73 61 2d 30 7a 61 70 38 70 2e 65 78 61 6d 70 6c 65
* $
*
*/
int
main (void)
{
char buf[BUFSIZ];
char *p;
int rc;
size_t i;
setlocale (LC_ALL, "");
printf ("Input domain encoded as `%s': ", stringprep_locale_charset ());
fflush (stdout);
fgets (buf, BUFSIZ, stdin);
buf[strlen (buf) - 1] = '\0';
printf ("Read string (length %d): ", strlen (buf));
for (i = 0; i < strlen (buf); i++)
printf ("%02x ", buf[i] & 0xFF);
printf ("\n");
rc = idna_to_ascii_lz (buf, &p, 0);
if (rc != IDNA_SUCCESS)
{
printf ("ToASCII() failed (%d): %s\n", rc, idna_strerror (rc));
exit (1);
}
printf ("ACE label (length %d): '%s'\n", strlen (p), p);
for (i = 0; i < strlen (p); i++)
printf ("%02x ", p[i] & 0xFF);
printf ("\n");
free (p);
return 0;
}
</pre>
<div class="node">
<a name="Example-4"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Example-5">Example 5</a>,
Previous: <a rel="previous" accesskey="p" href="#Example-3">Example 3</a>,
Up: <a rel="up" accesskey="u" href="#Examples">Examples</a>
</div>
<h3 class="section">9.4 Example 4</h3>
<p>This example demonstrates how the library is used to convert ASCII
compatible names to internationalized domain names.
<pre class="verbatim">/* example4.c --- Example ToUnicode() code showing how to use Libidn.
* Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Simon Josefsson
*
* This file is part of GNU Libidn.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h> /* setlocale() */
#include <stringprep.h> /* stringprep_locale_charset() */
#include <idna.h> /* idna_to_unicode_lzlz() */
/*
* Compiling using libtool and pkg-config is recommended:
*
* $ libtool cc -o example4 example4.c `pkg-config --cflags --libs libidn`
* $ ./example4
* Input domain encoded as `ISO-8859-1': www.xn--rksmrgsa-0zap8p.example
* Read string (length 33): 77 77 77 2e 78 6e 2d 2d 72 6b 73 6d 72 67 73 61 2d 30 7a 61 70 38 70 2e 65 78 61 6d 70 6c 65
* ACE label (length 23): 'www.räksmörgåsa.example'
* 77 77 77 2e 72 e4 6b 73 6d f6 72 67 e5 73 61 2e 65 78 61 6d 70 6c 65
* $
*
*/
int
main (void)
{
char buf[BUFSIZ];
char *p;
int rc;
size_t i;
setlocale (LC_ALL, "");
printf ("Input domain encoded as `%s': ", stringprep_locale_charset ());
fflush (stdout);
fgets (buf, BUFSIZ, stdin);
buf[strlen (buf) - 1] = '\0';
printf ("Read string (length %d): ", strlen (buf));
for (i = 0; i < strlen (buf); i++)
printf ("%02x ", buf[i] & 0xFF);
printf ("\n");
rc = idna_to_unicode_lzlz (buf, &p, 0);
if (rc != IDNA_SUCCESS)
{
printf ("ToUnicode() failed (%d): %s\n", rc, idna_strerror (rc));
exit (1);
}
printf ("ACE label (length %d): '%s'\n", strlen (p), p);
for (i = 0; i < strlen (p); i++)
printf ("%02x ", p[i] & 0xFF);
printf ("\n");
free (p);
return 0;
}
</pre>
<div class="node">
<a name="Example-5"></a>
<p><hr>
Previous: <a rel="previous" accesskey="p" href="#Example-4">Example 4</a>,
Up: <a rel="up" accesskey="u" href="#Examples">Examples</a>
</div>
<h3 class="section">9.5 Example 5</h3>
<p>This example demonstrates how the library is used to check a string
for invalid characters within a specific TLD.
<pre class="verbatim">/* example5.c --- Example TLD checking.
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Simon Josefsson
*
* This file is part of GNU Libidn.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Get stringprep_locale_charset, etc. */
#include <stringprep.h>
/* Get idna_to_ascii_8z, etc. */
#include <idna.h>
/* Get tld_check_4z. */
#include <tld.h>
/*
* Compiling using libtool and pkg-config is recommended:
*
* $ libtool cc -o example5 example5.c `pkg-config --cflags --libs libidn`
* $ ./example5
* Input domain encoded as `UTF-8': fooß.no
* Read string (length 8): 66 6f 6f c3 9f 2e 6e 6f
* ToASCII string (length 8): fooss.no
* ToUnicode string: U+0066 U+006f U+006f U+0073 U+0073 U+002e U+006e U+006f
* Domain accepted by TLD check
*
* $ ./example5
* Input domain encoded as `UTF-8': gr€€n.no
* Read string (length 12): 67 72 e2 82 ac e2 82 ac 6e 2e 6e 6f
* ToASCII string (length 16): xn--grn-l50aa.no
* ToUnicode string: U+0067 U+0072 U+20ac U+20ac U+006e U+002e U+006e U+006f
* Domain rejected by TLD check, Unicode position 2
*
*/
int
main (void)
{
char buf[BUFSIZ];
char *p;
uint32_t *r;
int rc;
size_t errpos, i;
printf ("Input domain encoded as `%s': ", stringprep_locale_charset ());
fflush (stdout);
fgets (buf, BUFSIZ, stdin);
buf[strlen (buf) - 1] = '\0';
printf ("Read string (length %d): ", strlen (buf));
for (i = 0; i < strlen (buf); i++)
printf ("%02x ", buf[i] & 0xFF);
printf ("\n");
p = stringprep_locale_to_utf8 (buf);
if (p)
{
strcpy (buf, p);
free (p);
}
else
printf ("Could not convert string to UTF-8, continuing anyway...\n");
rc = idna_to_ascii_8z (buf, &p, 0);
if (rc != IDNA_SUCCESS)
{
printf ("idna_to_ascii_8z failed (%d): %s\n", rc, idna_strerror (rc));
return 2;
}
printf ("ToASCII string (length %d): %s\n", strlen (p), p);
rc = idna_to_unicode_8z4z (p, &r, 0);
free (p);
if (rc != IDNA_SUCCESS)
{
printf ("idna_to_unicode_8z4z failed (%d): %s\n",
rc, idna_strerror (rc));
return 2;
}
printf ("ToUnicode string: ");
for (i = 0; r[i]; i++)
printf ("U+%04x ", r[i]);
printf ("\n");
rc = tld_check_4z (r, &errpos, NULL);
free (r);
if (rc == TLD_INVALID)
{
printf ("Domain rejected by TLD check, Unicode position %d\n", errpos);
return 1;
}
else if (rc != TLD_SUCCESS)
{
printf ("tld_check_4z() failed (%d): %s\n", rc, tld_strerror (rc));
return 2;
}
printf ("Domain accepted by TLD check\n");
return 0;
}
</pre>
<!-- ********************************************************** -->
<!-- ********************* Invoking idn ********************* -->
<!-- ********************************************************** -->
<div class="node">
<a name="Invoking-idn"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Emacs-API">Emacs API</a>,
Previous: <a rel="previous" accesskey="p" href="#Examples">Examples</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">10 Invoking idn</h2>
<p><a name="index-idn-111"></a><a name="index-invoking-_0040command_007bidn_007d-112"></a><a name="index-command-line-113"></a>
<h3 class="section">10.1 Name</h3>
<p>GNU Libidn (idn) – Internationalized Domain Names command line tool
<h3 class="section">10.2 Description</h3>
<p><code>idn</code> allows internationalized string preparation
(‘<samp><span class="samp">stringprep</span></samp>’), encoding and decoding of punycode data, and IDNA
ToASCII/ToUnicode operations to be performed on the command line.
<p>If strings are specified on the command line, they are used as input
and the computed output is printed to standard output <code>stdout</code>.
If no strings are specified on the command line, the program read
data, line by line, from the standard input <code>stdin</code>, and print
the computed output to standard output. What processing is performed
(e.g., ToASCII, or Punycode encode) is indicated by options. If any
errors are encountered, the execution of the applications is aborted.
<p>All strings are expected to be encoded in the preferred charset used
by your locale. Use <code>--debug</code> to find out what this charset is.
You can override the charset used by setting environment variable
<code>CHARSET</code>.
<p>To process a string that starts with <code>-</code>, for example
<code>-foo</code>, use <code>--</code> to signal the end of parameters, as in
<code>idn --quiet -a -- -foo</code>.
<h3 class="section">10.3 Options</h3>
<p><code>idn</code> recognizes these commands:
<pre class="verbatim"> -h, --help Print help and exit
-V, --version Print version and exit
-s, --stringprep Prepare string according to nameprep profile
-d, --punycode-decode Decode Punycode
-e, --punycode-encode Encode Punycode
-a, --idna-to-ascii Convert to ACE according to IDNA (default mode)
-u, --idna-to-unicode Convert from ACE according to IDNA
--allow-unassigned Toggle IDNA AllowUnassigned flag (default off)
--usestd3asciirules Toggle IDNA UseSTD3ASCIIRules flag (default off)
--no-tld Don't check string for TLD specific rules
Only for --idna-to-ascii and --idna-to-unicode
-n, --nfkc Normalize string according to Unicode v3.2 NFKC
-p, --profile=STRING Use specified stringprep profile instead
Valid stringprep profiles: `Nameprep',
`iSCSI', `Nodeprep', `Resourceprep',
`trace', `SASLprep'
--debug Print debugging information
--quiet Silent operation
</pre>
<h3 class="section">10.4 Environment Variables</h3>
<p>The <var>CHARSET</var> environment variable can be used to override what
character set to be used for decoding incoming data (i.e., on the
command line or on the standard input stream), and to encode data to
the standard output. If your system is set up correctly, however, the
application will guess which character set is used automatically.
Example usage:
<pre class="example"> $ CHARSET=ISO-8859-1 idn --punycode-encode
...
</pre>
<h3 class="section">10.5 Examples</h3>
<p>Standard usage, reading input from standard input:
<pre class="example"> jas@latte:~$ idn
libidn 0.3.5
Copyright 2002, 2003 Simon Josefsson.
GNU Libidn comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Libidn under the terms of
the GNU Lesser General Public License. For more information
about these matters, see the file named COPYING.LIB.
Type each input string on a line by itself, terminated by a newline character.
räksmörgås.se
xn--rksmrgs-5wao1o.se
jas@latte:~$
</pre>
<p>Reading input from command line, and disabling copyright and license
information:
<pre class="example"> jas@latte:~$ idn --quiet räksmörgås.se blåbærgrød.no
xn--rksmrgs-5wao1o.se
xn--blbrgrd-fxak7p.no
jas@latte:~$
</pre>
<p>Accessing a specific StringPrep profile directly:
<pre class="example"> jas@latte:~$ idn --quiet --profile=SASLprep --stringprep teßtª
teßta
jas@latte:~$
</pre>
<h3 class="section">10.6 Troubleshooting</h3>
<p>Getting character data encoded right, and making sure Libidn use the
same encoding, can be difficult. The reason for this is that most
systems encode character data in more than one character encoding,
i.e., using <code>UTF-8</code> together with <code>ISO-8859-1</code> or
<code>ISO-2022-JP</code>. This problem is likely to continue to exist until
only one character encoding come out as the evolutionary winner, or
(more likely, at least to some extents) forever.
<p>The first step to troubleshooting character encoding problems with
Libidn is to use the ‘<samp><span class="samp">--debug</span></samp>’ parameter to find out which
character set encoding ‘<samp><span class="samp">idn</span></samp>’ believe your locale uses.
<pre class="example"> jas@latte:~$ idn --debug --quiet ""
system locale uses charset `UTF-8'.
jas@latte:~$
</pre>
<p>If it prints <code>ANSI_X3.4-1968</code> (i.e., <code>US-ASCII</code>), this
indicate you have not configured your locale properly. To configure
the locale, you can, for example, use ‘<samp><span class="samp">LANG=sv_SE.UTF-8; export
LANG</span></samp>’ at a <code>/bin/sh</code> prompt, to set up your locale for a Swedish
environment using <code>UTF-8</code> as the encoding.
<p>Sometimes ‘<samp><span class="samp">idn</span></samp>’ appear to be unable to translate from your system
locale into <code>UTF-8</code> (which is used internally), and you get an
error like the following:
<pre class="example"> jas@latte:~$ idn --quiet foo
idn: could not convert from ISO-8859-1 to UTF-8.
jas@latte:~$
</pre>
<p>The simplest explanation is that you haven't installed the
‘<samp><span class="samp">iconv</span></samp>’ conversion tools. You can find it as a standalone
library in <acronym>GNU</acronym> Libiconv
(<a href="http://www.gnu.org/software/libiconv/">http://www.gnu.org/software/libiconv/</a>). On many
<acronym>GNU</acronym>/Linux systems, this library is part of the system, but
you may have to install additional packages (e.g., ‘<samp><span class="samp">glibc-locale</span></samp>’
for Debian) to be able to use it.
<p>Another explanation is that the error is correct and you are feeding
‘<samp><span class="samp">idn</span></samp>’ invalid data. This can happen inadvertently if you are not
careful with the character set encodings you use. For example, if
your shell run in a <code>ISO-8859-1</code> environment, and you invoke
‘<samp><span class="samp">idn</span></samp>’ with the ‘<samp><span class="samp">CHARSET</span></samp>’ environment variable as follows,
you will feed it <code>ISO-8859-1</code> characters but force it to believe
they are <code>UTF-8</code>. Naturally this will lead to an error, unless
the byte sequences happen to be parsable as <code>UTF-8</code>. Note that
even if you don't get an error, the output may be incorrect in this
situation, because <code>ISO-8859-1</code> and <code>UTF-8</code> does not in
general encode the same characters as the same byte sequences.
<pre class="example"> jas@latte:~$ idn --quiet --debug ""
system locale uses charset `ISO-8859-1'.
jas@latte:~$ CHARSET=UTF-8 idn --quiet --debug räksmörgås
system locale uses charset `UTF-8'.
input[0] = U+0072
input[1] = U+4af3
input[2] = U+006d
input[3] = U+1b29e5
input[4] = U+0073
output[0] = U+0078
output[1] = U+006e
output[2] = U+002d
output[3] = U+002d
output[4] = U+0072
output[5] = U+006d
output[6] = U+0073
output[7] = U+002d
output[8] = U+0068
output[9] = U+0069
output[10] = U+0036
output[11] = U+0064
output[12] = U+0035
output[13] = U+0039
output[14] = U+0037
output[15] = U+0035
output[16] = U+0035
output[17] = U+0032
output[18] = U+0061
xn--rms-hi6d597552a
jas@latte:~$
</pre>
<p>The sense moral here is to forget about ‘<samp><span class="samp">CHARSET</span></samp>’ (configure your
locales properly instead) unless you know what you are doing, and if
you want to use it, do it carefully, after verifying with
‘<samp><span class="samp">--debug</span></samp>’ that you get the desired results.
<div class="node">
<a name="Emacs-API"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Java-API">Java API</a>,
Previous: <a rel="previous" accesskey="p" href="#Invoking-idn">Invoking idn</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">11 Emacs API</h2>
<p>Included in Libidn are <samp><span class="file">punycode.el</span></samp> and <samp><span class="file">idna.el</span></samp> that
provides an Emacs Lisp API to (a limited set of) the Libidn API. This
section describes the API. Currently the IDNA API always set the
<code>UseSTD3ASCIIRules</code> flag and clear the <code>AllowUnassigned</code>
flag, in the future there may be functionality to specify these flags
via the API.
<h3 class="section">11.1 Punycode Emacs API</h3>
<div class="defun">
— Variable: <b>punycode-program</b><var><a name="index-punycode_002dprogram-114"></a></var><br>
<blockquote><p>Name of the GNU Libidn <samp><span class="file">idn</span></samp> application. The default is
‘<samp><span class="samp">idn</span></samp>’. This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Variable: <b>punycode-environment</b><var><a name="index-punycode_002denvironment-115"></a></var><br>
<blockquote><p>List of environment variable definitions prepended to
‘<samp><span class="samp">process-environment</span></samp>’. The default is ‘<samp><span class="samp">("CHARSET=UTF-8")</span></samp>’.
This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Variable: <b>punycode-encode-parameters</b><var><a name="index-punycode_002dencode_002dparameters-116"></a></var><br>
<blockquote><p>List of parameters passed to <var>punycode-program</var> to invoke punycode
encoding mode. The default is ‘<samp><span class="samp">("--quiet" "--punycode-encode")</span></samp>’.
This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Variable: <b>punycode-decode-parameters</b><var><a name="index-punycode_002ddecode_002dparameters-117"></a></var><br>
<blockquote><p>Parameters passed to <var>punycode-program</var> to invoke punycode
decoding mode. The default is ‘<samp><span class="samp">("--quiet" "--punycode-decode")</span></samp>’.
This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Function: <b>punycode-encode</b><var> string<a name="index-punycode_002dencode-118"></a></var><br>
<blockquote><p>Returns a Punycode encoding of the <var>string</var>, after converting the
input into UTF-8.
</p></blockquote></div>
<div class="defun">
— Function: <b>punycode-decode</b><var> string<a name="index-punycode_002ddecode-119"></a></var><br>
<blockquote><p>Returns a possibly multibyte string which is the decoding of the
<var>string</var> which is a punycode encoded string.
</p></blockquote></div>
<h3 class="section">11.2 IDNA Emacs API</h3>
<div class="defun">
— Variable: <b>idna-program</b><var><a name="index-idna_002dprogram-120"></a></var><br>
<blockquote><p>Name of the GNU Libidn <samp><span class="file">idn</span></samp> application. The default is
‘<samp><span class="samp">idn</span></samp>’. This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Variable: <b>idna-environment</b><var><a name="index-idna_002denvironment-121"></a></var><br>
<blockquote><p>List of environment variable definitions prepended to
‘<samp><span class="samp">process-environment</span></samp>’. The default is ‘<samp><span class="samp">("CHARSET=UTF-8")</span></samp>’.
This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Variable: <b>idna-to-ascii-parameters</b><var><a name="index-idna_002dto_002dascii_002dparameters-122"></a></var><br>
<blockquote><p>List of parameters passed to <var>idna-program</var> to invoke IDNA ToASCII
mode. The default is ‘<samp><span class="samp">("--quiet" "--idna-to-ascii"
"--usestd3asciirules")</span></samp>’. This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Variable: <b>idna-to-unicode-parameters</b><var><a name="index-idna_002dto_002dunicode_002dparameters-123"></a></var><br>
<blockquote><p>Parameters passed <var>idna-program</var> to invoke IDNA ToUnicode mode.
The default is ‘<samp><span class="samp">("--quiet" "--idna-to-unicode"
"--usestd3asciirules")</span></samp>’. This variable can be customized.
</p></blockquote></div>
<div class="defun">
— Function: <b>idna-to-ascii</b><var> string<a name="index-idna_002dto_002dascii-124"></a></var><br>
<blockquote><p>Returns an ASCII Compatible Encoding (ACE) of the string computed by
the IDNA ToASCII operation on the input <var>string</var>, after converting
the input to UTF-8.
</p></blockquote></div>
<div class="defun">
— Function: <b>idna-to-unicode</b><var> string<a name="index-idna_002dto_002dunicode-125"></a></var><br>
<blockquote><p>Returns a possibly multibyte string which is the output of the IDNA
ToUnicode operation computed on the input <var>string</var>.
</p></blockquote></div>
<div class="node">
<a name="Java-API"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#C_0023-API">C# API</a>,
Previous: <a rel="previous" accesskey="p" href="#Emacs-API">Emacs API</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">12 Java API</h2>
<p>Libidn has been ported to the Java programming language, and as a
consequence most of the API is available to native Java applications.
This section contain notes on this support, complete documentation is
pending.
<p>The Java library, if Libidn has been built with Java support
(see <a href="#Downloading-and-Installing">Downloading and Installing</a>), will be placed in
<samp><span class="file">java/libidn-1.15.jar</span></samp>. The source code is located in
<samp><span class="file">java/gnu/inet/encoding/</span></samp>.
<h3 class="section">12.1 Overview</h3>
<p>This package provides a Java implementation of the Internationalized
Domain Names in Applications (IDNA) standard. It is written entirely
in Java and does not require any additional libraries to be set up.
<p>The gnu.inet.encoding.IDNA class offers two public functions, toASCII
and toUnicode which can be used as follows:
<pre class="example"> gnu.inet.encoding.IDNA.toASCII("blöds.züg");
gnu.inet.encoding.IDNA.toUnicode("xn--blds-6qa.xn--zg-xka");
</pre>
<h3 class="section">12.2 Miscellaneous Programs</h3>
<p>The <samp><span class="file">misc/</span></samp> directory contains several programs that are related
to the Java part of GNU Libidn, but that don't need to be included in
the main source tree.
<h4 class="subsection">12.2.1 GenerateRFC3454</h4>
<p>This program parses RFC3454 and creates the RFC3454.java program that
is required during the StringPrep phase.
<p>The RFC can be found at various locations, for example at
<a href="http://www.ietf.org/rfc/rfc3454.txt">http://www.ietf.org/rfc/rfc3454.txt</a>.
<p>Invoke the program as follows:
<pre class="example"> $ java GenerateRFC3454
Creating RFC3454.java... Ok.
</pre>
<h4 class="subsection">12.2.2 GenerateNFKC</h4>
<p>The GenerateNFKC program parses the Unicode character database file
and generates all the tables required for NFKC. This program requires
the two files UnicodeData.txt and CompositionExclusions.txt of version
3.2 of the Unicode files. Note that RFC3454 (Stringprep) defines that
Unicode version 3.2 is to be used, not the latest version.
<p>The Unicode data files can be found at
<a href="http://www.unicode.org/Public/">http://www.unicode.org/Public/</a>.
<p>Invoke the program as follows:
<pre class="example"> $ java GenerateNFKC
Creating CombiningClass.java... Ok.
Creating DecompositionKeys.java... Ok.
Creating DecompositionMappings.java... Ok.
Creating Composition.java... Ok.
</pre>
<h4 class="subsection">12.2.3 TestIDNA</h4>
<p>The TestIDNA program allows to test the IDNA implementation manually
or against Simon Josefsson's test vectors.
<p>The test vectors can be found at the Libidn homepage,
<a href="http://www.gnu.org/software/libidn/">http://www.gnu.org/software/libidn/</a>.
<p>To test the tranformation manually, use:
<pre class="example"> $ java -cp .:../libidn.jar TestIDNA -a <string to test>
Input: <string to test>
Output: <toASCII(string to test)>
$ java -cp .:../libidn.jar TestIDNA -u <string to test>
Input: <string to test>
Output: <toUnicode(string to test)>
</pre>
<p>To test against draft-josefsson-idn-test-vectors.html, use:
<pre class="example"> $ java -cp .:../libidn.jar TestIDNA -t
No errors detected!
</pre>
<h4 class="subsection">12.2.4 TestNFKC</h4>
<p>The TestNFKC program allows to test the NFKC implementation manually
or against the NormalizationTest.txt file from the Unicode data files.
<p>To test the normalization manually, use:
<pre class="example"> $ java -cp .:../libidn.jar TestNFKC <string to test>
Input: <string to test>
Output: <nfkc version of the string to test>
</pre>
<p>To test against NormalizationTest.txt:
<pre class="example"> $ java -cp .:../libidn.jar TestNFKC
No errors detected!
</pre>
<h3 class="section">12.3 Possible Problems</h3>
<p>Beware of Bugs: This Java API needs a lot more testing, especially
with "exotic" character sets. While it works for me, it may not work
for you.
<p>Encoding of your Java sources: If you are using non-ASCII characters
in your Java source code, make sure javac compiles your programs with
the correct encoding. If necessary specify the encoding using the
-encoding parameter.
<p>Java Unicode handling: Java 1.4 only handles 16-bit Unicode code
points (i.e. characters in the Basic Multilingual Plane), this
implementation therefore ignores all references to so-called
Supplementary Characters (U+10000 to U+10FFFF). Starting from Java
1.5, these characters will also be supported by Java, but this will
require changes to this library. See also the next section.
<h3 class="section">12.4 A Note on Java and Unicode</h3>
<p>This library uses Java's builtin 'char' datatype. Up to Java 1.4, this
datatype only supports 16-bit Unicode code points, also called the
Basic Multilingual Plane. For this reason, this library doesn't work
for Supplementary Characters (i.e. characters from U+10000 to
U+10FFFF). All references to such characters are silently ignored.
<p>Starting from Java 1.5, also Supplementary Characters will be
supported. However, this will require changes in the present version
of the library. Java 1.5 is currently in beta status.
<p>For more information refer to the documentation of java.lang.Character
in the JDK API.
<div class="node">
<a name="C%23-API"></a>
<a name="C_0023-API"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Acknowledgements">Acknowledgements</a>,
Previous: <a rel="previous" accesskey="p" href="#Java-API">Java API</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">13 C# API</h2>
<p>The Libidn library has been ported to the C# language. The port
reside in the top-level <samp><span class="file">csharp/</span></samp> directory. Currently, no
further documentation about the implementation or the API is
available. However, the C# port was based on the Java port, and the
API is exactly the same as in the Java version. The help files for
the Java API may thus be useful.
<!-- ********************************************************** -->
<!-- ******************* Acknowledgements ******************* -->
<!-- ********************************************************** -->
<div class="node">
<a name="Acknowledgements"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#History">History</a>,
Previous: <a rel="previous" accesskey="p" href="#C_0023-API">C# API</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">14 Acknowledgements</h2>
<p>The punycode implementation was taken from the IETF IDN Punycode
specification, by Adam M. Costello. The TLD code was contributed by
Thomas Jacob. The Java implementation was contributed by Oliver Hitz.
The C# implementation was contributed by Alexander Gnauck. The
Unicode tables were provided by Unicode, Inc. Some functions for
dealing with Unicode (see nfkc.c and toutf8.c) were borrowed from
GLib, downloaded from <a href="http://www.gtk.org/">http://www.gtk.org/</a>. The manual borrowed
text from Libgcrypt by Werner Koch.
<p>Inspiration for many things that, consciously or not, have gone into
this package is due to a number of free software package that the
author has been exposed to. The author wishes to acknowledge the free
software community in general, for giving an example on what role
software development can play in the modern society.
<p>Several people reported bugs, sent patches or suggested improvements,
see the file THANKS in the top-level directory of the source code.
<!-- ********************************************************** -->
<!-- ************************ History *********************** -->
<!-- ********************************************************** -->
<div class="node">
<a name="History"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#PR29-discussion">PR29 discussion</a>,
Previous: <a rel="previous" accesskey="p" href="#Acknowledgements">Acknowledgements</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="chapter">15 History</h2>
<p>The complete history of user visible changes is stored in the file
<samp><span class="file">NEWS</span></samp> in the top-level directory of the source code tree. The
complete history of modifications to each file is stored in the file
<samp><span class="file">ChangeLog</span></samp> in the same directory. This section contain a
condensed version of that information, in the form of “milestones”
for the project.
<dl>
<dt>Stringprep implementation.<dd>Version 0.0.0 released on 2002-11-05.
<br><dt>IDNA and Punycode implementations, part of the GNU project.<dd>Version 0.1.0 released on 2003-01-05.
<br><dt>Uses official IDNA ACE prefix <code>xn--</code>.<dd>Version 0.1.7 released on 2003-02-12.
<br><dt>Command line interface.<dd>Version 0.1.11 released on 2003-02-26.
<br><dt>GNU Libc add-on proposed.<dd>Version 0.1.12 released on 2003-03-06.
<br><dt>Interoperability testing during IDNConnect.<dd>Version 0.3.1 released on 2003-10-02.
<br><dt>TLD restriction testing.<dd>Version 0.4.0 released on 2004-02-28.
<br><dt>GNU Libc add-on integrated.<dd>Version 0.4.1 released on 2004-03-08.
<br><dt>Native Java implementation.<dd>Version 0.4.2-0.4.9 released between 2004-03-20 and 2004-06-11.
<br><dt>PR-29 functions for “problem sequences”.<dd>Version 0.5.0 released on 2004-06-26.
<br><dt>Many small portability fixes and wider use.<dd>Version 0.5.1 through 0.5.20, released between 2004-07-09 and
2005-10-23.
<br><dt>Native C# implementation.<dd>Version 0.6.0 released on 2005-12-03.
<br><dt>Windows support through cross-compilation.<dd>Version 0.6.1 released on 2006-01-20.
<br><dt>Library declared stable by releasing v1.0.<dd>Version 1.0 released on 2007-07-31.
</dl>
<div class="node">
<a name="PR29-discussion"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#On-Label-Separators">On Label Separators</a>,
Previous: <a rel="previous" accesskey="p" href="#History">History</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="appendix">Appendix A PR29 discussion</h2>
<p>If you wish to experiment with a modified Unicode NFKC implementation
according to the PR29 proposal, you may find the following bug report
useful. However, I have not verified that the suggested modifications
are correct. For reference, I'm including my response to the report
as well.
<pre class="verbatim">From: Rick McGowan <rick@unicode.org>
Subject: Possible bug and status of PR 29 change(s)
To: bug-libidn@gnu.org
Date: Wed, 27 Oct 2004 14:49:17 -0700
Hello. On behalf of the Unicode Consortium editorial committee, I would
like to find out more information about the PR 29 fixes, if any, and
functions in Libidn. Your implementation was listed in the text of PR29 as
needing investigation, so I am following up on several implementations.
The UTC has accepted the proposed fix to D2 as outlined in PR29, and a new
draft of UAX #15 has been issued.
I have looked at Libidn 0.5.8 (today), and there may still be a possible
bug in NFKC.java and nfkc.c.
------------------------------------------------------
1. In NFKC.java, this line in canonicalOrdering():
if (i > 0 && (last_cc == 0 || last_cc != cc)) {
should perhaps be changed to:
if (i > 0 && (last_cc == 0 || last_cc < cc)) {
but I'm not sure of the sense of this comparison.
------------------------------------------------------
2. In nfkc.c, function _g_utf8_normalize_wc() has this code:
if (i > 0 &&
(last_cc == 0 || last_cc != cc) &&
combine (wc_buffer[last_start], wc_buffer[i],
&wc_buffer[last_start]))
{
This appears to have the same bug as the current Python implementation (in
Python 2.3.4). The code should be checking, as per new rule D2 UAX #15
update, that the next combining character is the same or HIGHER than the
current one. It now checks to see if it's non-zero and not equal.
The above line(s) should perhaps be changed to:
if (i > 0 &&
(last_cc == 0 || last_cc < cc) &&
combine (wc_buffer[last_start], wc_buffer[i],
&wc_buffer[last_start]))
{
but I'm not sure of the sense of the comparison (< or > or <=?) here.
In the text of PR29, I will be marking Libidn as "needs change" and adding
the version number that I checked. If any further change is made, please
let me know the release version, and I'll update again.
Regards,
Rick McGowan
</pre>
<pre class="verbatim">From: Simon Josefsson <jas@extundo.com>
Subject: Re: Possible bug and status of PR 29 change(s)
To: Rick McGowan <rick@unicode.org>
Cc: bug-libidn@gnu.org
Date: Thu, 28 Oct 2004 09:47:47 +0200
Rick McGowan <rick@unicode.org> writes:
> Hello. On behalf of the Unicode Consortium editorial committee, I would
> like to find out more information about the PR 29 fixes, if any, and
> functions in Libidn. Your implementation was listed in the text of PR29 as
> needing investigation, so I am following up on several implementations.
>
> The UTC has accepted the proposed fix to D2 as outlined in PR29, and a new
> draft of UAX #15 has been issued.
>
> I have looked at Libidn 0.5.8 (today), and there may still be a possible
> bug in NFKC.java and nfkc.c.
Hello Rick.
I believe the current behavior is intentional. Libidn do not aim to
implement latest-and-greatest NFKC, it aim to implement the NFKC
functionality required for StringPrep and IDN. As you may know,
StringPrep/IDN reference Unicode 3.2.0, and explicitly says any later
changes (which I consider PR29 as) do not apply.
In fact, I believe that would I incorporate the changes suggested in
PR29, I would in fact be violating the IDN specifications.
Thanks for looking into the code and finding the place where the
change could be made. I'll see if I can mention this in the manual
somewhere, for technically interested readers.
Regards,
Simon
</pre>
<div class="node">
<a name="On-Label-Separators"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Copying-Information">Copying Information</a>,
Previous: <a rel="previous" accesskey="p" href="#PR29-discussion">PR29 discussion</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="appendix">Appendix B On Label Separators</h2>
<p>Some strings contains characters whose NFKC normalized form contain
the ASCII dot (0x2E, “.”). Examples of these characters are U+2024
(ONE DOT LEADER) and U+248C (DIGIT FIVE FULL STOP). The strings have
the interesting property that their IDNA ToASCII output will contain
embedded dots. For example:
<pre class="example"> ToASCII (hi U+248C com) = hi5.com
ToASCII (räksmörgås U+2024 com) = xn--rksmrgs.com-l8as9u
</pre>
<p>This demonstrate the two general cases: The first where the ASCII dot
is part of an output that do not begin with the IDN prefix
<code>xn--</code>. The second example illustrate when the dot is part of
IDN prefixed with <code>xn--</code>.
<p>The input strings are, from the DNS point of view, a single label.
The IDNA algorithm translate one label at a time. Thus, the output is
expected to be only one label. What is important here is to make sure
the DNS resolver receives the correct query. The DNS protocol does
not use the dot to delimit labels on the wire, rather it uses
length-value pairs. Thus the correct query would be for
<code>{7}hi5.com</code> and <code>{22}xn--rksmrgs.com-l8as9u</code>
respectively.
<p>Some implementations <a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a> have decided that
these inputs strings are potentially confusing for the user. The
string <code>hi U+248C com</code> looks like <code>hi5.com</code> on systems that
support Unicode properly. These implementations do not follow RFC
3490. They yield:
<pre class="example"> ToASCII (hi U+248C com) = hi5.com
ToASCII (räksmörgås U+2024 com) = xn--rksmrgs-5wao1o.com
</pre>
<p>The DNS query they perform are <code>{3}hi5{3}com</code> and
<code>{18}xn--rksmrgs-5wao1o{3}com</code> respectively. Arguably, this
leads to a better user experience, and suggests that the IDNA
specification is sub-optimal in this area.
<h3 class="section">B.1 Recommended Workaround</h3>
<p>It has been suggested to normalize the entire input string using NFKC
before passing it to IDNA ToASCII. You may use
<code>stringprep_utf8_nfkc_normalize</code> or
<code>stringprep_ucs4_nfkc_normalize</code>. This appears to lead to
similar behaviour as IE/Firefox, which would avoid the problem, but
this needs to be confirmed. Feel free to discuss the issue with us.
<p>Alternative workarounds are being considered. Eventually Libidn may
implement a new flag to the <code>idna_*</code> functions that implements a
recommended way to work around this problem.
<div class="node">
<a name="Copying-Information"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Function-and-Variable-Index">Function and Variable Index</a>,
Previous: <a rel="previous" accesskey="p" href="#On-Label-Separators">On Label Separators</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="appendix">Appendix C Copying Information</h2>
<ul class="menu">
<li><a accesskey="1" href="#GNU-Free-Documentation-License">GNU Free Documentation License</a>: License for copying this manual.
<li><a accesskey="2" href="#GNU-LGPL">GNU LGPL</a>: License for copying the library.
<li><a accesskey="3" href="#GNU-GPL">GNU GPL</a>: License for copying the programs.
</ul>
<div class="node">
<a name="GNU-Free-Documentation-License"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#GNU-LGPL">GNU LGPL</a>,
Up: <a rel="up" accesskey="u" href="#Copying-Information">Copying Information</a>
</div>
<h3 class="appendixsec">C.1 GNU Free Documentation License</h3>
<p><a name="index-FDL_002c-GNU-Free-Documentation-License-126"></a>
<!-- The GNU Free Documentation License. -->
<div align="center">Version 1.3, 3 November 2008</div>
<!-- This file is intended to be included within another document, -->
<!-- hence no sectioning command or @node. -->
<pre class="display"> Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
<a href="http://fsf.org/">http://fsf.org/</a>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
</pre>
<ol type=1 start=0>
<li>PREAMBLE
<p>The purpose of this License is to make a manual, textbook, or other
functional and useful document <dfn>free</dfn> in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
<p>This License is a kind of “copyleft”, which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
<p>We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
<li>APPLICABILITY AND DEFINITIONS
<p>This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The “Document”, below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as “you”. You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
<p>A “Modified Version” of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
<p>A “Secondary Section” is a named appendix or a front-matter section
of the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall
subject (or to related matters) and contains nothing that could fall
directly within that overall subject. (Thus, if the Document is in
part a textbook of mathematics, a Secondary Section may not explain
any mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
<p>The “Invariant Sections” are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
<p>The “Cover Texts” are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
<p>A “Transparent” copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not “Transparent” is called “Opaque”.
<p>Examples of suitable formats for Transparent copies include plain
<span class="sc">ascii</span> without markup, Texinfo input format, LaTeX input
format, <acronym>SGML</acronym> or <acronym>XML</acronym> using a publicly available
<acronym>DTD</acronym>, and standard-conforming simple <acronym>HTML</acronym>,
PostScript or <acronym>PDF</acronym> designed for human modification. Examples
of transparent image formats include <acronym>PNG</acronym>, <acronym>XCF</acronym> and
<acronym>JPG</acronym>. Opaque formats include proprietary formats that can be
read and edited only by proprietary word processors, <acronym>SGML</acronym> or
<acronym>XML</acronym> for which the <acronym>DTD</acronym> and/or processing tools are
not generally available, and the machine-generated <acronym>HTML</acronym>,
PostScript or <acronym>PDF</acronym> produced by some word processors for
output purposes only.
<p>The “Title Page” means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, “Title Page” means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
<p>The “publisher” means any person or entity that distributes copies
of the Document to the public.
<p>A section “Entitled XYZ” means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as “Acknowledgements”,
“Dedications”, “Endorsements”, or “History”.) To “Preserve the Title”
of such a section when you modify the Document means that it remains a
section “Entitled XYZ” according to this definition.
<p>The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
<li>VERBATIM COPYING
<p>You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
<p>You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
<li>COPYING IN QUANTITY
<p>If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
<p>If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
<p>If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
<p>It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
<li>MODIFICATIONS
<p>You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
<ol type=A start=1>
<li>Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
<li>List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
<li>State on the Title page the name of the publisher of the
Modified Version, as the publisher.
<li>Preserve all the copyright notices of the Document.
<li>Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
<li>Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
<li>Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
<li>Include an unaltered copy of this License.
<li>Preserve the section Entitled “History”, Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled “History” in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
<li>Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the “History” section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
<li>For any section Entitled “Acknowledgements” or “Dedications”, Preserve
the Title of the section, and preserve in the section all the
substance and tone of each of the contributor acknowledgements and/or
dedications given therein.
<li>Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
<li>Delete any section Entitled “Endorsements”. Such a section
may not be included in the Modified Version.
<li>Do not retitle any existing section to be Entitled “Endorsements” or
to conflict in title with any Invariant Section.
<li>Preserve any Warranty Disclaimers.
</ol>
<p>If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
<p>You may add a section Entitled “Endorsements”, provided it contains
nothing but endorsements of your Modified Version by various
parties—for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
<p>You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
<p>The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
<li>COMBINING DOCUMENTS
<p>You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
<p>The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
<p>In the combination, you must combine any sections Entitled “History”
in the various original documents, forming one section Entitled
“History”; likewise combine any sections Entitled “Acknowledgements”,
and any sections Entitled “Dedications”. You must delete all
sections Entitled “Endorsements.”
<li>COLLECTIONS OF DOCUMENTS
<p>You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
<p>You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
<li>AGGREGATION WITH INDEPENDENT WORKS
<p>A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an “aggregate” if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
<p>If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
<li>TRANSLATION
<p>Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
<p>If a section in the Document is Entitled “Acknowledgements”,
“Dedications”, or “History”, the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
<li>TERMINATION
<p>You may not copy, modify, sublicense, or distribute the Document
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense, or distribute it is void, and
will automatically terminate your rights under this License.
<p>However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
<p>Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
<p>Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, receipt of a copy of some or all of the same material does
not give you any rights to use it.
<li>FUTURE REVISIONS OF THIS LICENSE
<p>The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
<a href="http://www.gnu.org/copyleft/">http://www.gnu.org/copyleft/</a>.
<p>Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License “or any later version” applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation. If the Document
specifies that a proxy can decide which future versions of this
License can be used, that proxy's public statement of acceptance of a
version permanently authorizes you to choose that version for the
Document.
<li>RELICENSING
<p>“Massive Multiauthor Collaboration Site” (or “MMC Site”) means any
World Wide Web server that publishes copyrightable works and also
provides prominent facilities for anybody to edit those works. A
public wiki that anybody can edit is an example of such a server. A
“Massive Multiauthor Collaboration” (or “MMC”) contained in the
site means any set of copyrightable works thus published on the MMC
site.
<p>“CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0
license published by Creative Commons Corporation, a not-for-profit
corporation with a principal place of business in San Francisco,
California, as well as future copyleft versions of that license
published by that same organization.
<p>“Incorporate” means to publish or republish a Document, in whole or
in part, as part of another Document.
<p>An MMC is “eligible for relicensing” if it is licensed under this
License, and if all works that were first published under this License
somewhere other than this MMC, and subsequently incorporated in whole
or in part into the MMC, (1) had no cover texts or invariant sections,
and (2) were thus incorporated prior to November 1, 2008.
<p>The operator of an MMC Site may republish an MMC contained in the site
under CC-BY-SA on the same site at any time before August 1, 2009,
provided the MMC is eligible for relicensing.
</ol>
<h3 class="heading">ADDENDUM: How to use this License for your documents</h3>
<p>To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
<pre class="smallexample"> Copyright (C) <var>year</var> <var>your name</var>.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts. A copy of the license is included in the section entitled ``GNU
Free Documentation License''.
</pre>
<p>If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the “with<small class="dots">...</small>Texts.” line with this:
<pre class="smallexample"> with the Invariant Sections being <var>list their titles</var>, with
the Front-Cover Texts being <var>list</var>, and with the Back-Cover Texts
being <var>list</var>.
</pre>
<p>If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
<p>If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.
<!-- Local Variables: -->
<!-- ispell-local-pdict: "ispell-dict" -->
<!-- End: -->
<div class="node">
<a name="GNU-LGPL"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#GNU-GPL">GNU GPL</a>,
Previous: <a rel="previous" accesskey="p" href="#GNU-Free-Documentation-License">GNU Free Documentation License</a>,
Up: <a rel="up" accesskey="u" href="#Copying-Information">Copying Information</a>
</div>
<h3 class="appendixsec">C.2 GNU Lesser General Public License</h3>
<p><a name="index-LGPL_002c-GNU-Lesser-General-Public-License-127"></a><a name="index-License_002c-GNU-LGPL-128"></a>
<!-- The GNU Lesser General Public License. -->
<div align="center">Version 2.1, February 1999</div>
<!-- This file is intended to be included within another document, -->
<!-- hence no sectioning command or @node. -->
<pre class="display"> Copyright © 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence the
version number 2.1.]
</pre>
<h4 class="subheading">Preamble</h4>
<p>The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software—to make sure the software is free for all its users.
<p>This license, the Lesser General Public License, applies to some
specially designated software—typically libraries—of the Free
Software Foundation and other authors who decide to use it. You can use
it too, but we suggest you first think carefully about whether this
license or the ordinary General Public License is the better strategy to
use in any particular case, based on the explanations below.
<p>When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of it
in new free programs; and that you are informed that you can do these
things.
<p>To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
<p>For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
<p>We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
<p>To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
<p>Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
<p>Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
<p>When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
<p>We call this license the <dfn>Lesser</dfn> General Public License because it
does <em>Less</em> to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
<p>For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
<p>In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
<p>Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
<p>The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
“work based on the library” and a “work that uses the library”. The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
<h4 class="subheading">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</h4>
<ol type=1 start=0>
<li>This License Agreement applies to any software library or other program
which contains a notice placed by the copyright holder or other
authorized party saying it may be distributed under the terms of this
Lesser General Public License (also called “this License”). Each
licensee is addressed as “you”.
<p>A “library” means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
<p>The “Library”, below, refers to any such software library or work
which has been distributed under these terms. A “work based on the
Library” means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term “modification”.)
<p>“Source code” for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
<p>Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
<li>You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
<p>You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
<li>You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
<ol type=a start=1>
<li>The modified work must itself be a software library.
<li>You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
<li>You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
<li>If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
<p>(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
</ol>
<p>These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
<p>Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
<p>In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
<li>You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
<p>Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
<p>This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
<li>You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
<p>If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
<li>A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a “work that uses the Library”. Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
<p>However, linking a “work that uses the Library” with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a “work that uses the
library”. The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
<p>When a “work that uses the Library” uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
<p>If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
<p>Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
<li>As an exception to the Sections above, you may also combine or
link a “work that uses the Library” with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
<p>You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
<ol type=a start=1>
<li>Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable “work that
uses the Library”, as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
<li>Use a suitable shared library mechanism for linking with the Library. A
suitable mechanism is one that (1) uses at run time a copy of the
library already present on the user's computer system, rather than
copying library functions into the executable, and (2) will operate
properly with a modified version of the library, if the user installs
one, as long as the modified version is interface-compatible with the
version that the work was made with.
<li>Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
<li>If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
<li>Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
</ol>
<p>For an executable, the required form of the “work that uses the
Library” must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies the
executable.
<p>It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
<li>You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
<ol type=a start=1>
<li>Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
<li>Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
</ol>
<li>You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
<li>You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
<li>Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
<li>If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
<p>If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
<p>It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
<p>This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
<li>If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
<li>The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
<p>Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
“any later version”, you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
<li>If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
<li>BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY “AS IS” WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
<li>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
</ol>
<h4 class="subheading">How to Apply These Terms to Your New Libraries</h4>
<p>If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
<p>To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
“copyright” line and a pointer to where the full notice is found.
<pre class="smallexample"> <var>one line to give the library's name and an idea of what it does.</var>
Copyright (C) <var>year</var> <var>name of author</var>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
</pre>
<p>Also add information on how to contact you by electronic and paper mail.
<p>You should also get your employer (if you work as a programmer) or your
school, if any, to sign a “copyright disclaimer” for the library, if
necessary. Here is a sample; alter the names:
<pre class="smallexample"> Yoyodyne, Inc., hereby disclaims all copyright interest in the library
`Frob' (a library for tweaking knobs) written by James Random Hacker.
<var>signature of Ty Coon</var>, 1 April 1990
Ty Coon, President of Vice
</pre>
<p>That's all there is to it!
<div class="node">
<a name="GNU-GPL"></a>
<p><hr>
Previous: <a rel="previous" accesskey="p" href="#GNU-LGPL">GNU LGPL</a>,
Up: <a rel="up" accesskey="u" href="#Copying-Information">Copying Information</a>
</div>
<h3 class="appendixsec">C.3 GNU General Public License</h3>
<p><a name="index-GPL_002c-GNU-General-Public-License-129"></a><a name="index-License_002c-GNU-GPL-130"></a>
<!-- The GNU General Public License. -->
<div align="center">Version 3, 29 June 2007</div>
<!-- This file is intended to be included within another document, -->
<!-- hence no sectioning command or @node. -->
<pre class="display"> Copyright © 2007 Free Software Foundation, Inc. <a href="http://fsf.org/">http://fsf.org/</a>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
</pre>
<h3 class="heading">Preamble</h3>
<p>The GNU General Public License is a free, copyleft license for
software and other kinds of works.
<p>The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom
to share and change all versions of a program—to make sure it remains
free software for all its users. We, the Free Software Foundation,
use the GNU General Public License for most of our software; it
applies also to any other work released this way by its authors. You
can apply it to your programs, too.
<p>When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
<p>To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you
have certain responsibilities if you distribute copies of the
software, or if you modify it: responsibilities to respect the freedom
of others.
<p>For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too,
receive or can get the source code. And you must show them these
terms so they know their rights.
<p>Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
<p>For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
<p>Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the
manufacturer can do so. This is fundamentally incompatible with the
aim of protecting users' freedom to change the software. The
systematic pattern of such abuse occurs in the area of products for
individuals to use, which is precisely where it is most unacceptable.
Therefore, we have designed this version of the GPL to prohibit the
practice for those products. If such problems arise substantially in
other domains, we stand ready to extend this provision to those
domains in future versions of the GPL, as needed to protect the
freedom of users.
<p>Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish
to avoid the special danger that patents applied to a free program
could make it effectively proprietary. To prevent this, the GPL
assures that patents cannot be used to render the program non-free.
<p>The precise terms and conditions for copying, distribution and
modification follow.
<h3 class="heading">TERMS AND CONDITIONS</h3>
<ol type=1 start=0>
<li>Definitions.
<p>“This License” refers to version 3 of the GNU General Public License.
<p>“Copyright” also means copyright-like laws that apply to other kinds
of works, such as semiconductor masks.
<p>“The Program” refers to any copyrightable work licensed under this
License. Each licensee is addressed as “you”. “Licensees” and
“recipients” may be individuals or organizations.
<p>To “modify” a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of
an exact copy. The resulting work is called a “modified version” of
the earlier work or a work “based on” the earlier work.
<p>A “covered work” means either the unmodified Program or a work based
on the Program.
<p>To “propagate” a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
<p>To “convey” a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user
through a computer network, with no transfer of a copy, is not
conveying.
<p>An interactive user interface displays “Appropriate Legal Notices” to
the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
<li>Source Code.
<p>The “source code” for a work means the preferred form of the work for
making modifications to it. “Object code” means any non-source form
of a work.
<p>A “Standard Interface” means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
<p>The “System Libraries” of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
“Major Component”, in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
<p>The “Corresponding Source” for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
<p>The Corresponding Source need not include anything that users can
regenerate automatically from other parts of the Corresponding Source.
<p>The Corresponding Source for a work in source code form is that same
work.
<li>Basic Permissions.
<p>All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
<p>You may make, run and propagate covered works that you do not convey,
without conditions so long as your license otherwise remains in force.
You may convey covered works to others for the sole purpose of having
them make modifications exclusively for you, or provide you with
facilities for running those works, provided that you comply with the
terms of this License in conveying all material for which you do not
control copyright. Those thus making or running the covered works for
you must do so exclusively on your behalf, under your direction and
control, on terms that prohibit them from making any copies of your
copyrighted material outside their relationship with you.
<p>Conveying under any other circumstances is permitted solely under the
conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
<li>Protecting Users' Legal Rights From Anti-Circumvention Law.
<p>No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
<p>When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such
circumvention is effected by exercising rights under this License with
respect to the covered work, and you disclaim any intention to limit
operation or modification of the work as a means of enforcing, against
the work's users, your or third parties' legal rights to forbid
circumvention of technological measures.
<li>Conveying Verbatim Copies.
<p>You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
<p>You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
<li>Conveying Modified Source Versions.
<p>You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these
conditions:
<ol type=a start=1>
<li>The work must carry prominent notices stating that you modified it,
and giving a relevant date.
<li>The work must carry prominent notices stating that it is released
under this License and any conditions added under section 7. This
requirement modifies the requirement in section 4 to “keep intact all
notices”.
<li>You must license the entire work, as a whole, under this License to
anyone who comes into possession of a copy. This License will
therefore apply, along with any applicable section 7 additional terms,
to the whole of the work, and all its parts, regardless of how they
are packaged. This License gives no permission to license the work in
any other way, but it does not invalidate such permission if you have
separately received it.
<li>If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your work
need not make them do so.
</ol>
<p>A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
“aggregate” if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
<li>Conveying Non-Source Forms.
<p>You may convey a covered work in object code form under the terms of
sections 4 and 5, provided that you also convey the machine-readable
Corresponding Source under the terms of this License, in one of these
ways:
<ol type=a start=1>
<li>Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium customarily
used for software interchange.
<li>Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a written
offer, valid for at least three years and valid for as long as you
offer spare parts or customer support for that product model, to give
anyone who possesses the object code either (1) a copy of the
Corresponding Source for all the software in the product that is
covered by this License, on a durable physical medium customarily used
for software interchange, for a price no more than your reasonable
cost of physically performing this conveying of source, or (2) access
to copy the Corresponding Source from a network server at no charge.
<li>Convey individual copies of the object code with a copy of the written
offer to provide the Corresponding Source. This alternative is
allowed only occasionally and noncommercially, and only if you
received the object code with such an offer, in accord with subsection
6b.
<li>Convey the object code by offering access from a designated place
(gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to copy
the object code is a network server, the Corresponding Source may be
on a different server (operated by you or a third party) that supports
equivalent copying facilities, provided you maintain clear directions
next to the object code saying where to find the Corresponding Source.
Regardless of what server hosts the Corresponding Source, you remain
obligated to ensure that it is available for as long as needed to
satisfy these requirements.
<li>Convey the object code using peer-to-peer transmission, provided you
inform other peers where the object code and Corresponding Source of
the work are being offered to the general public at no charge under
subsection 6d.
</ol>
<p>A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
<p>A “User Product” is either (1) a “consumer product”, which means any
tangible personal property which is normally used for personal,
family, or household purposes, or (2) anything designed or sold for
incorporation into a dwelling. In determining whether a product is a
consumer product, doubtful cases shall be resolved in favor of
coverage. For a particular product received by a particular user,
“normally used” refers to a typical or common use of that class of
product, regardless of the status of the particular user or of the way
in which the particular user actually uses, or expects or is expected
to use, the product. A product is a consumer product regardless of
whether the product has substantial commercial, industrial or
non-consumer uses, unless such uses represent the only significant
mode of use of the product.
<p>“Installation Information” for a User Product means any methods,
procedures, authorization keys, or other information required to
install and execute modified versions of a covered work in that User
Product from a modified version of its Corresponding Source. The
information must suffice to ensure that the continued functioning of
the modified object code is in no case prevented or interfered with
solely because modification has been made.
<p>If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
<p>The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or
updates for a work that has been modified or installed by the
recipient, or for the User Product in which it has been modified or
installed. Access to a network may be denied when the modification
itself materially and adversely affects the operation of the network
or violates the rules and protocols for communication across the
network.
<p>Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
<li>Additional Terms.
<p>“Additional permissions” are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
<p>When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
<p>Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders
of that material) supplement the terms of this License with terms:
<ol type=a start=1>
<li>Disclaiming warranty or limiting liability differently from the terms
of sections 15 and 16 of this License; or
<li>Requiring preservation of specified reasonable legal notices or author
attributions in that material or in the Appropriate Legal Notices
displayed by works containing it; or
<li>Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
<li>Limiting the use for publicity purposes of names of licensors or
authors of the material; or
<li>Declining to grant rights under trademark law for use of some trade
names, trademarks, or service marks; or
<li>Requiring indemnification of licensors and authors of that material by
anyone who conveys the material (or modified versions of it) with
contractual assumptions of liability to the recipient, for any
liability that these contractual assumptions directly impose on those
licensors and authors.
</ol>
<p>All other non-permissive additional terms are considered “further
restrictions” within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
<p>If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
<p>Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions; the
above requirements apply either way.
<li>Termination.
<p>You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
<p>However, if you cease all violation of this License, then your license
from a particular copyright holder is reinstated (a) provisionally,
unless and until the copyright holder explicitly and finally
terminates your license, and (b) permanently, if the copyright holder
fails to notify you of the violation by some reasonable means prior to
60 days after the cessation.
<p>Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
<p>Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
<li>Acceptance Not Required for Having Copies.
<p>You are not required to accept this License in order to receive or run
a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
<li>Automatic Licensing of Downstream Recipients.
<p>Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
<p>An “entity transaction” is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
<p>You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
<li>Patents.
<p>A “contributor” is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's “contributor version”.
<p>A contributor's “essential patent claims” are all patent claims owned
or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, “control” includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
<p>Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
<p>In the following three paragraphs, a “patent license” is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To “grant” such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
<p>If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. “Knowingly relying” means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
<p>If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
<p>A patent license is “discriminatory” if it does not include within the
scope of its coverage, prohibits the exercise of, or is conditioned on
the non-exercise of one or more of the rights that are specifically
granted under this License. You may not convey a covered work if you
are a party to an arrangement with a third party that is in the
business of distributing software, under which you make payment to the
third party based on the extent of your activity of conveying the
work, and under which the third party grants, to any of the parties
who would receive the covered work from you, a discriminatory patent
license (a) in connection with copies of the covered work conveyed by
you (or copies made from those copies), or (b) primarily for and in
connection with specific products or compilations that contain the
covered work, unless you entered into that arrangement, or that patent
license was granted, prior to 28 March 2007.
<p>Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
<li>No Surrender of Others' Freedom.
<p>If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey
a covered work so as to satisfy simultaneously your obligations under
this License and any other pertinent obligations, then as a
consequence you may not convey it at all. For example, if you agree
to terms that obligate you to collect a royalty for further conveying
from those to whom you convey the Program, the only way you could
satisfy both those terms and this License would be to refrain entirely
from conveying the Program.
<li>Use with the GNU Affero General Public License.
<p>Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
<li>Revised Versions of this License.
<p>The Free Software Foundation may publish revised and/or new versions
of the GNU General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
<p>Each version is given a distinguishing version number. If the Program
specifies that a certain numbered version of the GNU General Public
License “or any later version” applies to it, you have the option of
following the terms and conditions either of that numbered version or
of any later version published by the Free Software Foundation. If
the Program does not specify a version number of the GNU General
Public License, you may choose any version ever published by the Free
Software Foundation.
<p>If the Program specifies that a proxy can decide which future versions
of the GNU General Public License can be used, that proxy's public
statement of acceptance of a version permanently authorizes you to
choose that version for the Program.
<p>Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
<li>Disclaimer of Warranty.
<p>THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT
WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
CORRECTION.
<li>Limitation of Liability.
<p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
<li>Interpretation of Sections 15 and 16.
<p>If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
</ol>
<h3 class="heading">END OF TERMS AND CONDITIONS</h3>
<h3 class="heading">How to Apply These Terms to Your New Programs</h3>
<p>If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
<p>To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the “copyright” line and a pointer to where the full notice is found.
<pre class="smallexample"> <var>one line to give the program's name and a brief idea of what it does.</var>
Copyright (C) <var>year</var> <var>name of author</var>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.
</pre>
<p>Also add information on how to contact you by electronic and paper mail.
<p>If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<pre class="smallexample"> <var>program</var> Copyright (C) <var>year</var> <var>name of author</var>
This program comes with ABSOLUTELY NO WARRANTY; for details type ‘<samp><span class="samp">show w</span></samp>’.
This is free software, and you are welcome to redistribute it
under certain conditions; type ‘<samp><span class="samp">show c</span></samp>’ for details.
</pre>
<p>The hypothetical commands ‘<samp><span class="samp">show w</span></samp>’ and ‘<samp><span class="samp">show c</span></samp>’ should show
the appropriate parts of the General Public License. Of course, your
program's commands might be different; for a GUI interface, you would
use an “about box”.
<p>You should also get your employer (if you work as a programmer) or school,
if any, to sign a “copyright disclaimer” for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.
<p>The GNU General Public License does not permit incorporating your
program into proprietary programs. If your program is a subroutine
library, you may consider it more useful to permit linking proprietary
applications with the library. If this is what you want to do, use
the GNU Lesser General Public License instead of this License. But
first, please read <a href="http://www.gnu.org/philosophy/why-not-lgpl.html">http://www.gnu.org/philosophy/why-not-lgpl.html</a>.
<div class="node">
<a name="Function-and-Variable-Index"></a>
<p><hr>
Next: <a rel="next" accesskey="n" href="#Concept-Index">Concept Index</a>,
Previous: <a rel="previous" accesskey="p" href="#Copying-Information">Copying Information</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="unnumbered">Function and Variable Index</h2>
<ul class="index-fn" compact>
<li><a href="#index-idn_005ffree-46"><code>idn_free</code></a>: <a href="#Memory-handling-under-Windows">Memory handling under Windows</a></li>
<li><a href="#index-idna_002dto_002dascii-124"><code>idna-to-ascii</code></a>: <a href="#Emacs-API">Emacs API</a></li>
<li><a href="#index-idna_002dto_002dunicode-125"><code>idna-to-unicode</code></a>: <a href="#Emacs-API">Emacs API</a></li>
<li><a href="#index-idna_005fstrerror-91"><code>idna_strerror</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005fascii_005f4i-81"><code>idna_to_ascii_4i</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005fascii_005f4z-83"><code>idna_to_ascii_4z</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005fascii_005f8z-84"><code>idna_to_ascii_8z</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005fascii_005flz-85"><code>idna_to_ascii_lz</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005funicode_005f44i-82"><code>idna_to_unicode_44i</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005funicode_005f4z4z-86"><code>idna_to_unicode_4z4z</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005funicode_005f8z4z-87"><code>idna_to_unicode_8z4z</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005funicode_005f8z8z-88"><code>idna_to_unicode_8z8z</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005funicode_005f8zlz-89"><code>idna_to_unicode_8zlz</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-idna_005fto_005funicode_005flzlz-90"><code>idna_to_unicode_lzlz</code></a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-pr29_005f4-106"><code>pr29_4</code></a>: <a href="#PR29-Functions">PR29 Functions</a></li>
<li><a href="#index-pr29_005f4z-107"><code>pr29_4z</code></a>: <a href="#PR29-Functions">PR29 Functions</a></li>
<li><a href="#index-pr29_005f8z-108"><code>pr29_8z</code></a>: <a href="#PR29-Functions">PR29 Functions</a></li>
<li><a href="#index-pr29_005fstrerror-109"><code>pr29_strerror</code></a>: <a href="#PR29-Functions">PR29 Functions</a></li>
<li><a href="#index-punycode_002ddecode-119"><code>punycode-decode</code></a>: <a href="#Emacs-API">Emacs API</a></li>
<li><a href="#index-punycode_002dencode-118"><code>punycode-encode</code></a>: <a href="#Emacs-API">Emacs API</a></li>
<li><a href="#index-punycode_005fdecode-75"><code>punycode_decode</code></a>: <a href="#Punycode-Functions">Punycode Functions</a></li>
<li><a href="#index-punycode_005fencode-74"><code>punycode_encode</code></a>: <a href="#Punycode-Functions">Punycode Functions</a></li>
<li><a href="#index-punycode_005fstrerror-76"><code>punycode_strerror</code></a>: <a href="#Punycode-Functions">Punycode Functions</a></li>
<li><a href="#index-stringprep-64"><code>stringprep</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005f4i-62"><code>stringprep_4i</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005f4zi-63"><code>stringprep_4zi</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005fcheck_005fversion-38"><code>stringprep_check_version</code></a>: <a href="#Version-Check">Version Check</a></li>
<li><a href="#index-stringprep_005fconvert-55"><code>stringprep_convert</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005fiscsi-68"><code>stringprep_iscsi</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005flocale_005fcharset-54"><code>stringprep_locale_charset</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005flocale_005fto_005futf8-56"><code>stringprep_locale_to_utf8</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005fnameprep_005fno_005funassigned-67"><code>stringprep_nameprep_no_unassigned</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005fplain-69"><code>stringprep_plain</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005fprofile-65"><code>stringprep_profile</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005fstrerror-66"><code>stringprep_strerror</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005fucs4_005fnfkc_005fnormalize-52"><code>stringprep_ucs4_nfkc_normalize</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005fucs4_005fto_005futf8-50"><code>stringprep_ucs4_to_utf8</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005funichar_005fto_005futf8-48"><code>stringprep_unichar_to_utf8</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005futf8_005fnfkc_005fnormalize-53"><code>stringprep_utf8_nfkc_normalize</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005futf8_005fto_005flocale-57"><code>stringprep_utf8_to_locale</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005futf8_005fto_005fucs4-51"><code>stringprep_utf8_to_ucs4</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005futf8_005fto_005funichar-49"><code>stringprep_utf8_to_unichar</code></a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-stringprep_005fxmpp_005fnodeprep-70"><code>stringprep_xmpp_nodeprep</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-stringprep_005fxmpp_005fresourceprep-71"><code>stringprep_xmpp_resourceprep</code></a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-tld_005fcheck_005f4-100"><code>tld_check_4</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fcheck_005f4t-93"><code>tld_check_4t</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fcheck_005f4tz-94"><code>tld_check_4tz</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fcheck_005f4z-101"><code>tld_check_4z</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fcheck_005f8z-102"><code>tld_check_8z</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fcheck_005flz-103"><code>tld_check_lz</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fdefault_005ftable-99"><code>tld_default_table</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fget_005f4-95"><code>tld_get_4</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fget_005f4z-96"><code>tld_get_4z</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fget_005ftable-98"><code>tld_get_table</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fget_005fz-97"><code>tld_get_z</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-tld_005fstrerror-104"><code>tld_strerror</code></a>: <a href="#TLD-Functions">TLD Functions</a></li>
</ul><div class="node">
<a name="Concept-Index"></a>
<p><hr>
Previous: <a rel="previous" accesskey="p" href="#Function-and-Variable-Index">Function and Variable Index</a>,
Up: <a rel="up" accesskey="u" href="#Top">Top</a>
</div>
<h2 class="unnumbered">Concept Index</h2>
<ul class="index-cp" compact>
<li><a href="#index-AIX-15">AIX</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-ARM-29">ARM</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Autoconf-tests-40">Autoconf tests</a>: <a href="#Autoconf-tests">Autoconf tests</a></li>
<li><a href="#index-command-line-113">command line</a>: <a href="#Invoking-idn">Invoking idn</a></li>
<li><a href="#index-Compiling-your-application-39">Compiling your application</a>: <a href="#Building-the-source">Building the source</a></li>
<li><a href="#index-Configure-tests-41">Configure tests</a>: <a href="#Autoconf-tests">Autoconf tests</a></li>
<li><a href="#index-Contributing-36">Contributing</a>: <a href="#Contributing">Contributing</a></li>
<li><a href="#index-de_002dallocation-44">de-allocation</a>: <a href="#Memory-handling-under-Windows">Memory handling under Windows</a></li>
<li><a href="#index-Debian-1">Debian</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Download-34">Download</a>: <a href="#Downloading-and-Installing">Downloading and Installing</a></li>
<li><a href="#index-Examples-110">Examples</a>: <a href="#Examples">Examples</a></li>
<li><a href="#index-FDL_002c-GNU-Free-Documentation-License-126">FDL, GNU Free Documentation License</a>: <a href="#GNU-Free-Documentation-License">GNU Free Documentation License</a></li>
<li><a href="#index-free-42">free</a>: <a href="#Memory-handling-under-Windows">Memory handling under Windows</a></li>
<li><a href="#index-FreeBSD-23">FreeBSD</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-GPL_002c-GNU-General-Public-License-129">GPL, GNU General Public License</a>: <a href="#GNU-GPL">GNU GPL</a></li>
<li><a href="#index-Hacking-37">Hacking</a>: <a href="#Contributing">Contributing</a></li>
<li><a href="#index-heap-memory-45">heap memory</a>: <a href="#Memory-handling-under-Windows">Memory handling under Windows</a></li>
<li><a href="#index-HP_002dUX-17">HP-UX</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-idn-111"><code>idn</code></a>: <a href="#Invoking-idn">Invoking idn</a></li>
<li><a href="#index-IDNA-Functions-77">IDNA Functions</a>: <a href="#IDNA-Functions">IDNA Functions</a></li>
<li><a href="#index-Installation-33">Installation</a>: <a href="#Downloading-and-Installing">Downloading and Installing</a></li>
<li><a href="#index-invoking-_0040command_007bidn_007d-112">invoking <samp><span class="command">idn</span></samp></a>: <a href="#Invoking-idn">Invoking idn</a></li>
<li><a href="#index-IRIX-14">IRIX</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-LGPL_002c-GNU-Lesser-General-Public-License-127">LGPL, GNU Lesser General Public License</a>: <a href="#GNU-LGPL">GNU LGPL</a></li>
<li><a href="#index-License_002c-GNU-GPL-130">License, GNU GPL</a>: <a href="#GNU-GPL">GNU GPL</a></li>
<li><a href="#index-License_002c-GNU-LGPL-128">License, GNU LGPL</a>: <a href="#GNU-LGPL">GNU LGPL</a></li>
<li><a href="#index-MacOS-X-24">MacOS X</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Mandrake-13">Mandrake</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Memory-handling-43">Memory handling</a>: <a href="#Memory-handling-under-Windows">Memory handling under Windows</a></li>
<li><a href="#index-Microsoft-31">Microsoft</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-mingw32-32">mingw32</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Motorola-Coldfire-26">Motorola Coldfire</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-NetBSD-21">NetBSD</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-OpenBSD-22">OpenBSD</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-OpenPower-720-8">OpenPower 720</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-PR29-Functions-105">PR29 Functions</a>: <a href="#PR29-Functions">PR29 Functions</a></li>
<li><a href="#index-Punycode-Functions-72">Punycode Functions</a>: <a href="#Punycode-Functions">Punycode Functions</a></li>
<li><a href="#index-RedHat-9">RedHat</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-RedHat-Advanced-Server-11">RedHat Advanced Server</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Reporting-Bugs-35">Reporting Bugs</a>: <a href="#Bug-Reports">Bug Reports</a></li>
<li><a href="#index-Solaris-18">Solaris</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Stringprep-Functions-58">Stringprep Functions</a>: <a href="#Stringprep-Functions">Stringprep Functions</a></li>
<li><a href="#index-SuSE-4">SuSE</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-SuSE-Linux-5">SuSE Linux</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-TLD-Functions-92">TLD Functions</a>: <a href="#TLD-Functions">TLD Functions</a></li>
<li><a href="#index-Tru64-3">Tru64</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-uClibc-28">uClibc</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-uClinux-27">uClinux</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
<li><a href="#index-Utility-Functions-47">Utility Functions</a>: <a href="#Utility-Functions">Utility Functions</a></li>
<li><a href="#index-Windows-16">Windows</a>: <a href="#Supported-Platforms">Supported Platforms</a></li>
</ul><div class="footnote">
<hr>
<a name="texinfo-footnotes-in-document"></a><h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> Notably Microsoft's Internet Explorer
and Mozilla's Firefox, but not Apple's Safari.</p>
<hr></div>
</body></html>
<!--
Local Variables:
coding: utf-8
End:
-->
|