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
|
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="libidn-stringprep">
<refmeta>
<refentrytitle role="top_of_page" id="libidn-stringprep.top_of_page">stringprep</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBIDN Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>stringprep</refname>
<refpurpose></refpurpose>
</refnamediv>
<refsynopsisdiv id="libidn-stringprep.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>
<synopsis>
#define <link linkend="IDNAPI--CAPS">IDNAPI</link>
#define <link linkend="STRINGPREP-VERSION--CAPS">STRINGPREP_VERSION</link>
enum <link linkend="Stringprep-rc">Stringprep_rc</link>;
enum <link linkend="Stringprep-profile-flags">Stringprep_profile_flags</link>;
enum <link linkend="Stringprep-profile-steps">Stringprep_profile_steps</link>;
#define <link linkend="STRINGPREP-MAX-MAP-CHARS--CAPS">STRINGPREP_MAX_MAP_CHARS</link>
typedef <link linkend="Stringprep-table-element">Stringprep_table_element</link>;
typedef <link linkend="Stringprep-profile">Stringprep_profile</link>;
typedef <link linkend="Stringprep-profiles">Stringprep_profiles</link>;
#define <link linkend="stringprep-nameprep">stringprep_nameprep</link> (in, maxlen)
#define <link linkend="stringprep-nameprep-no-unassigned">stringprep_nameprep_no_unassigned</link> (in, maxlen)
#define <link linkend="stringprep-plain">stringprep_plain</link> (in, maxlen)
#define <link linkend="stringprep-kerberos5">stringprep_kerberos5</link> (in, maxlen)
#define <link linkend="stringprep-xmpp-nodeprep">stringprep_xmpp_nodeprep</link> (in, maxlen)
#define <link linkend="stringprep-xmpp-resourceprep">stringprep_xmpp_resourceprep</link> (in, maxlen)
#define <link linkend="stringprep-iscsi">stringprep_iscsi</link> (in, maxlen)
<link linkend="int">int</link> <link linkend="stringprep-4i">stringprep_4i</link> (<link linkend="uint32-t">uint32_t</link> *ucs4,
<link linkend="size-t">size_t</link> *len,
<link linkend="size-t">size_t</link> maxucs4len,
<link linkend="Stringprep-profile-flags">Stringprep_profile_flags</link> flags,
const <link linkend="Stringprep-profile">Stringprep_profile</link> *profile);
<link linkend="int">int</link> <link linkend="stringprep-4zi">stringprep_4zi</link> (<link linkend="uint32-t">uint32_t</link> *ucs4,
<link linkend="size-t">size_t</link> maxucs4len,
<link linkend="Stringprep-profile-flags">Stringprep_profile_flags</link> flags,
const <link linkend="Stringprep-profile">Stringprep_profile</link> *profile);
<link linkend="int">int</link> <link linkend="stringprep">stringprep</link> (<link linkend="char">char</link> *in,
<link linkend="size-t">size_t</link> maxlen,
<link linkend="Stringprep-profile-flags">Stringprep_profile_flags</link> flags,
const <link linkend="Stringprep-profile">Stringprep_profile</link> *profile);
<link linkend="int">int</link> <link linkend="stringprep-profile">stringprep_profile</link> (const <link linkend="char">char</link> *in,
<link linkend="char">char</link> **out,
const <link linkend="char">char</link> *profile,
<link linkend="Stringprep-profile-flags">Stringprep_profile_flags</link> flags);
const <link linkend="char">char</link> * <link linkend="stringprep-strerror">stringprep_strerror</link> (<link linkend="Stringprep-rc">Stringprep_rc</link> rc);
const <link linkend="char">char</link> * <link linkend="stringprep-check-version">stringprep_check_version</link> (const <link linkend="char">char</link> *req_version);
<link linkend="int">int</link> <link linkend="stringprep-unichar-to-utf8">stringprep_unichar_to_utf8</link> (<link linkend="uint32-t">uint32_t</link> c,
<link linkend="char">char</link> *outbuf);
<link linkend="uint32-t">uint32_t</link> <link linkend="stringprep-utf8-to-unichar">stringprep_utf8_to_unichar</link> (const <link linkend="char">char</link> *p);
<link linkend="uint32-t">uint32_t</link> * <link linkend="stringprep-utf8-to-ucs4">stringprep_utf8_to_ucs4</link> (const <link linkend="char">char</link> *str,
<link linkend="ssize-t">ssize_t</link> len,
<link linkend="size-t">size_t</link> *items_written);
<link linkend="char">char</link> * <link linkend="stringprep-ucs4-to-utf8">stringprep_ucs4_to_utf8</link> (const <link linkend="uint32-t">uint32_t</link> *str,
<link linkend="ssize-t">ssize_t</link> len,
<link linkend="size-t">size_t</link> *items_read,
<link linkend="size-t">size_t</link> *items_written);
<link linkend="char">char</link> * <link linkend="stringprep-utf8-nfkc-normalize">stringprep_utf8_nfkc_normalize</link> (const <link linkend="char">char</link> *str,
<link linkend="ssize-t">ssize_t</link> len);
<link linkend="uint32-t">uint32_t</link> * <link linkend="stringprep-ucs4-nfkc-normalize">stringprep_ucs4_nfkc_normalize</link> (<link linkend="uint32-t">uint32_t</link> *str,
<link linkend="ssize-t">ssize_t</link> len);
const <link linkend="char">char</link> * <link linkend="stringprep-locale-charset">stringprep_locale_charset</link> (void);
<link linkend="char">char</link> * <link linkend="stringprep-convert">stringprep_convert</link> (const <link linkend="char">char</link> *str,
const <link linkend="char">char</link> *to_codeset,
const <link linkend="char">char</link> *from_codeset);
<link linkend="char">char</link> * <link linkend="stringprep-locale-to-utf8">stringprep_locale_to_utf8</link> (const <link linkend="char">char</link> *str);
<link linkend="char">char</link> * <link linkend="stringprep-utf8-to-locale">stringprep_utf8_to_locale</link> (const <link linkend="char">char</link> *str);
</synopsis>
</refsynopsisdiv>
<refsect1 id="libidn-stringprep.description" role="desc">
<title role="desc.title">Description</title>
<para>
</para>
</refsect1>
<refsect1 id="libidn-stringprep.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="IDNAPI--CAPS" role="macro">
<title>IDNAPI</title>
<indexterm zone="IDNAPI--CAPS"><primary sortas="IDNAPI">IDNAPI</primary></indexterm><programlisting>#define IDNAPI</programlisting>
<para>
</para></refsect2>
<refsect2 id="STRINGPREP-VERSION--CAPS" role="macro">
<title>STRINGPREP_VERSION</title>
<indexterm zone="STRINGPREP-VERSION--CAPS"><primary sortas="STRINGPREP_VERSION">STRINGPREP_VERSION</primary></indexterm><programlisting># define STRINGPREP_VERSION "1.15"
</programlisting>
<para>
String defined via CPP denoting the header file version number.
Used together with <link linkend="stringprep-check-version"><function>stringprep_check_version()</function></link> to verify header file
and run-time library consistency.</para>
<para>
</para></refsect2>
<refsect2 id="Stringprep-rc" role="enum">
<title>enum Stringprep_rc</title>
<indexterm zone="Stringprep-rc"><primary sortas="Stringprep_rc">Stringprep_rc</primary></indexterm><programlisting> typedef enum
{
STRINGPREP_OK = 0,
/* Stringprep errors. */
STRINGPREP_CONTAINS_UNASSIGNED = 1,
STRINGPREP_CONTAINS_PROHIBITED = 2,
STRINGPREP_BIDI_BOTH_L_AND_RAL = 3,
STRINGPREP_BIDI_LEADTRAIL_NOT_RAL = 4,
STRINGPREP_BIDI_CONTAINS_PROHIBITED = 5,
/* Error in calling application. */
STRINGPREP_TOO_SMALL_BUFFER = 100,
STRINGPREP_PROFILE_ERROR = 101,
STRINGPREP_FLAG_ERROR = 102,
STRINGPREP_UNKNOWN_PROFILE = 103,
/* Internal errors. */
STRINGPREP_NFKC_FAILED = 200,
STRINGPREP_MALLOC_ERROR = 201
} Stringprep_rc;
</programlisting>
<para>
Enumerated return codes of <link linkend="stringprep"><function>stringprep()</function></link>, <link linkend="stringprep-profile"><function>stringprep_profile()</function></link>
functions (and macros using those functions). The value 0 is
guaranteed to always correspond to success.</para>
<para>
</para><variablelist role="enum">
<varlistentry id="STRINGPREP-OK--CAPS" role="constant">
<term><literal>STRINGPREP_OK</literal></term>
<listitem><simpara> 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.
</simpara></listitem>
</varlistentry>
<varlistentry id="STRINGPREP-CONTAINS-UNASSIGNED--CAPS" role="constant">
<term><literal>STRINGPREP_CONTAINS_UNASSIGNED</literal></term>
<listitem><simpara> String contain unassigned Unicode
code points, which is forbidden by the profile.
</simpara></listitem>
</varlistentry>
<varlistentry id="STRINGPREP-CONTAINS-PROHIBITED--CAPS" role="constant">
<term><literal>STRINGPREP_CONTAINS_PROHIBITED</literal></term>
<listitem><simpara> String contain code points
prohibited by the profile.
</simpara></listitem>
</varlistentry>
<varlistentry id="STRINGPREP-BIDI-BOTH-L-AND-RAL--CAPS" role="constant">
<term><literal>STRINGPREP_BIDI_BOTH_L_AND_RAL</literal></term>
<listitem><simpara> String contain code points with
conflicting bidirection category.
</simpara></listitem>
</varlistentry>
<varlistentry id="STRINGPREP-BIDI-LEADTRAIL-NOT-RAL--CAPS" role="constant">
<term><literal>STRINGPREP_BIDI_LEADTRAIL_NOT_RAL</literal></term>
<listitem><simpara> Leading and trailing character
in string not of proper bidirectional category.
</simpara></listitem>
</varlistentry>
<varlistentry id="STRINGPREP-BIDI-CONTAINS-PROHIBITED--CAPS" role="constant">
<term><literal>STRINGPREP_BIDI_CONTAINS_PROHIBITED</literal></term>
<listitem><simpara> Contains prohibited code
points detected by bidirectional code.
</simpara></listitem>
</varlistentry>
<varlistentry id="STRINGPREP-TOO-SMALL-BUFFER--CAPS" role="constant">
<term><literal>STRINGPREP_TOO_SMALL_BUFFER</literal></term>
<listitem><simpara> Buffer handed to function was too
small. This usually indicate a problem in the calling
application.
</simpara></listitem>
</varlistentry>
<varlistentry id="STRINGPREP-PROFILE-ERROR--CAPS" role="constant">
<term><literal>STRINGPREP_PROFILE_ERROR</literal></term>
<listitem><simpara> The stringprep profile was inconsistent.
This usually indicate an internal error in the library.
</simpara></listitem>
</varlistentry>
<varlistentry id="STRINGPREP-FLAG-ERROR--CAPS" role="constant">
<term><literal>STRINGPREP_FLAG_ERROR</literal></term>
<listitem><simpara> The supplied flag conflicted with profile.
This usually indicate a problem in the calling application.
</simpara></listitem>
</varlistentry>
<varlistentry id="STRINGPREP-UNKNOWN-PROFILE--CAPS" role="constant">
<term><literal>STRINGPREP_UNKNOWN_PROFILE</literal></term>
<listitem><simpara> The supplied profile name was not
known to the library.
</simpara></listitem>
</varlistentry>
<varlistentry id="STRINGPREP-NFKC-FAILED--CAPS" role="constant">
<term><literal>STRINGPREP_NFKC_FAILED</literal></term>
<listitem><simpara> The Unicode NFKC operation failed. This
usually indicate an internal error in the library.
</simpara></listitem>
</varlistentry>
<varlistentry id="STRINGPREP-MALLOC-ERROR--CAPS" role="constant">
<term><literal>STRINGPREP_MALLOC_ERROR</literal></term>
<listitem><simpara> The <link linkend="malloc"><function>malloc()</function></link> was out of memory. This is
usually a fatal error.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="Stringprep-profile-flags" role="enum">
<title>enum Stringprep_profile_flags</title>
<indexterm zone="Stringprep-profile-flags"><primary sortas="Stringprep_profile_flags">Stringprep_profile_flags</primary></indexterm><programlisting> typedef enum
{
STRINGPREP_NO_NFKC = 1,
STRINGPREP_NO_BIDI = 2,
STRINGPREP_NO_UNASSIGNED = 4
} Stringprep_profile_flags;
</programlisting>
<para>
Stringprep profile flags.</para>
<para>
</para><variablelist role="enum">
<varlistentry id="STRINGPREP-NO-NFKC--CAPS" role="constant">
<term><literal>STRINGPREP_NO_NFKC</literal></term>
<listitem><simpara> 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.
</simpara></listitem>
</varlistentry>
<varlistentry id="STRINGPREP-NO-BIDI--CAPS" role="constant">
<term><literal>STRINGPREP_NO_BIDI</literal></term>
<listitem><simpara> Disable the BIDI step. Usually the profile
specifies BIDI and NFKC settings, and applications should not
override it unless in special situations.
</simpara></listitem>
</varlistentry>
<varlistentry id="STRINGPREP-NO-UNASSIGNED--CAPS" role="constant">
<term><literal>STRINGPREP_NO_UNASSIGNED</literal></term>
<listitem><simpara> Make the library return with an error if
string contains unassigned characters according to profile.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="Stringprep-profile-steps" role="enum">
<title>enum Stringprep_profile_steps</title>
<indexterm zone="Stringprep-profile-steps"><primary sortas="Stringprep_profile_steps">Stringprep_profile_steps</primary></indexterm><programlisting> typedef enum
{
STRINGPREP_NFKC = 1,
STRINGPREP_BIDI = 2,
STRINGPREP_MAP_TABLE = 3,
STRINGPREP_UNASSIGNED_TABLE = 4,
STRINGPREP_PROHIBIT_TABLE = 5,
STRINGPREP_BIDI_PROHIBIT_TABLE = 6,
STRINGPREP_BIDI_RAL_TABLE = 7,
STRINGPREP_BIDI_L_TABLE = 8
} Stringprep_profile_steps;
</programlisting>
<para>
Various steps in the stringprep algorithm. You really want to
study the source code to understand this one. Only useful if you
want to add another profile.</para>
<para>
</para></refsect2>
<refsect2 id="STRINGPREP-MAX-MAP-CHARS--CAPS" role="macro">
<title>STRINGPREP_MAX_MAP_CHARS</title>
<indexterm zone="STRINGPREP-MAX-MAP-CHARS--CAPS"><primary sortas="STRINGPREP_MAX_MAP_CHARS">STRINGPREP_MAX_MAP_CHARS</primary></indexterm><programlisting># define STRINGPREP_MAX_MAP_CHARS 4
</programlisting>
<para>
Maximum number of code points that can replace a single code point,
during stringprep mapping.</para>
<para>
</para></refsect2>
<refsect2 id="Stringprep-table-element" role="typedef">
<title>Stringprep_table_element</title>
<indexterm zone="Stringprep-table-element"><primary sortas="Stringprep_table_element">Stringprep_table_element</primary></indexterm><programlisting> typedef struct Stringprep_table_element Stringprep_table_element;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="Stringprep-profile" role="typedef">
<title>Stringprep_profile</title>
<indexterm zone="Stringprep-profile"><primary sortas="Stringprep_profile">Stringprep_profile</primary></indexterm><programlisting> typedef struct Stringprep_table Stringprep_profile;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="Stringprep-profiles" role="typedef">
<title>Stringprep_profiles</title>
<indexterm zone="Stringprep-profiles"><primary sortas="Stringprep_profiles">Stringprep_profiles</primary></indexterm><programlisting> typedef struct Stringprep_profiles Stringprep_profiles;
</programlisting>
<para>
</para></refsect2>
<refsect2 id="stringprep-nameprep" role="macro">
<title>stringprep_nameprep()</title>
<indexterm zone="stringprep-nameprep"><primary sortas="stringprep_nameprep">stringprep_nameprep</primary></indexterm><programlisting>#define stringprep_nameprep(in, maxlen)</programlisting>
<para>
Prepare the input UTF-8 string according to the nameprep profile.
The AllowUnassigned flag is true, use
<link linkend="stringprep-nameprep-no-unassigned"><function>stringprep_nameprep_no_unassigned()</function></link> if you want a false
AllowUnassigned. Returns 0 iff successful, or an error code.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>in</parameter> :</term>
<listitem><simpara> input/ouput array with string to prepare.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>maxlen</parameter> :</term>
<listitem><simpara> maximum length of input/output array.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-nameprep-no-unassigned" role="macro">
<title>stringprep_nameprep_no_unassigned()</title>
<indexterm zone="stringprep-nameprep-no-unassigned"><primary sortas="stringprep_nameprep_no_unassigned">stringprep_nameprep_no_unassigned</primary></indexterm><programlisting>#define stringprep_nameprep_no_unassigned(in, maxlen)</programlisting>
<para>
Prepare the input UTF-8 string according to the nameprep profile.
The AllowUnassigned flag is false, use <link linkend="stringprep-nameprep"><function>stringprep_nameprep()</function></link> for
true AllowUnassigned. Returns 0 iff successful, or an error code.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>in</parameter> :</term>
<listitem><simpara> input/ouput array with string to prepare.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>maxlen</parameter> :</term>
<listitem><simpara> maximum length of input/output array.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-plain" role="macro">
<title>stringprep_plain()</title>
<indexterm zone="stringprep-plain"><primary sortas="stringprep_plain">stringprep_plain</primary></indexterm><programlisting>#define stringprep_plain(in, maxlen)</programlisting>
<para>
Prepare the input UTF-8 string according to the draft SASL
ANONYMOUS profile. Returns 0 iff successful, or an error code.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>in</parameter> :</term>
<listitem><simpara> input/ouput array with string to prepare.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>maxlen</parameter> :</term>
<listitem><simpara> maximum length of input/output array.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-kerberos5" role="macro">
<title>stringprep_kerberos5()</title>
<indexterm zone="stringprep-kerberos5"><primary sortas="stringprep_kerberos5">stringprep_kerberos5</primary></indexterm><programlisting>#define stringprep_kerberos5(in, maxlen)</programlisting>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>in</parameter> :</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>maxlen</parameter> :</term>
<listitem><simpara>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-xmpp-nodeprep" role="macro">
<title>stringprep_xmpp_nodeprep()</title>
<indexterm zone="stringprep-xmpp-nodeprep"><primary sortas="stringprep_xmpp_nodeprep">stringprep_xmpp_nodeprep</primary></indexterm><programlisting>#define stringprep_xmpp_nodeprep(in, maxlen)</programlisting>
<para>
Prepare the input UTF-8 string according to the draft XMPP node
identifier profile. Returns 0 iff successful, or an error code.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>in</parameter> :</term>
<listitem><simpara> input/ouput array with string to prepare.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>maxlen</parameter> :</term>
<listitem><simpara> maximum length of input/output array.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-xmpp-resourceprep" role="macro">
<title>stringprep_xmpp_resourceprep()</title>
<indexterm zone="stringprep-xmpp-resourceprep"><primary sortas="stringprep_xmpp_resourceprep">stringprep_xmpp_resourceprep</primary></indexterm><programlisting>#define stringprep_xmpp_resourceprep(in, maxlen)</programlisting>
<para>
Prepare the input UTF-8 string according to the draft XMPP resource
identifier profile. Returns 0 iff successful, or an error code.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>in</parameter> :</term>
<listitem><simpara> input/ouput array with string to prepare.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>maxlen</parameter> :</term>
<listitem><simpara> maximum length of input/output array.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-iscsi" role="macro">
<title>stringprep_iscsi()</title>
<indexterm zone="stringprep-iscsi"><primary sortas="stringprep_iscsi">stringprep_iscsi</primary></indexterm><programlisting>#define stringprep_iscsi(in, maxlen)</programlisting>
<para>
Prepare the input UTF-8 string according to the draft iSCSI
stringprep profile. Returns 0 iff successful, or an error code.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>in</parameter> :</term>
<listitem><simpara> input/ouput array with string to prepare.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>maxlen</parameter> :</term>
<listitem><simpara> maximum length of input/output array.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-4i" role="function">
<title>stringprep_4i ()</title>
<indexterm zone="stringprep-4i"><primary sortas="stringprep_4i">stringprep_4i</primary></indexterm><programlisting><link linkend="int">int</link> stringprep_4i (<link linkend="uint32-t">uint32_t</link> *ucs4,
<link linkend="size-t">size_t</link> *len,
<link linkend="size-t">size_t</link> maxucs4len,
<link linkend="Stringprep-profile-flags">Stringprep_profile_flags</link> flags,
const <link linkend="Stringprep-profile">Stringprep_profile</link> *profile);</programlisting>
<para>
Prepare the input UCS-4 string according to the stringprep profile,
and write back the result to the input string.
</para>
<para>
The input is not required to be zero terminated (<parameter>ucs4</parameter>[<parameter>len</parameter>] = 0).
The output will not be zero terminated unless <parameter>ucs4</parameter>[<parameter>len</parameter>] = 0.
Instead, see <link linkend="stringprep-4zi"><function>stringprep_4zi()</function></link> if your input is zero terminated or
if you want the output to be.
</para>
<para>
Since the stringprep operation can expand the string, <parameter>maxucs4len</parameter>
indicate how large the buffer holding the string is. This function
will not read or write to code points outside that size.
</para>
<para>
The <parameter>flags</parameter> are one of <link linkend="Stringprep-profile-flags"><type>Stringprep_profile_flags</type></link> values, or 0.
</para>
<para>
The <parameter>profile</parameter> contain the <link linkend="Stringprep-profile"><type>Stringprep_profile</type></link> 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.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>ucs4</parameter> :</term>
<listitem><simpara> input/output array with string to prepare.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter> :</term>
<listitem><simpara> on input, length of input array with Unicode code points,
on exit, length of output array with Unicode code points.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>maxucs4len</parameter> :</term>
<listitem><simpara> maximum length of input/output array.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter> :</term>
<listitem><simpara> a <link linkend="Stringprep-profile-flags"><type>Stringprep_profile_flags</type></link> value, or 0.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>profile</parameter> :</term>
<listitem><simpara> pointer to <link linkend="Stringprep-profile"><type>Stringprep_profile</type></link> to use.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> Returns <link linkend="STRINGPREP-OK--CAPS"><literal>STRINGPREP_OK</literal></link> iff successful, or an
<link linkend="Stringprep-rc"><type>Stringprep_rc</type></link> error code.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-4zi" role="function">
<title>stringprep_4zi ()</title>
<indexterm zone="stringprep-4zi"><primary sortas="stringprep_4zi">stringprep_4zi</primary></indexterm><programlisting><link linkend="int">int</link> stringprep_4zi (<link linkend="uint32-t">uint32_t</link> *ucs4,
<link linkend="size-t">size_t</link> maxucs4len,
<link linkend="Stringprep-profile-flags">Stringprep_profile_flags</link> flags,
const <link linkend="Stringprep-profile">Stringprep_profile</link> *profile);</programlisting>
<para>
Prepare the input zero terminated UCS-4 string according to the
stringprep profile, and write back the result to the input string.
</para>
<para>
Since the stringprep operation can expand the string, <parameter>maxucs4len</parameter>
indicate how large the buffer holding the string is. This function
will not read or write to code points outside that size.
</para>
<para>
The <parameter>flags</parameter> are one of <link linkend="Stringprep-profile-flags"><type>Stringprep_profile_flags</type></link> values, or 0.
</para>
<para>
The <parameter>profile</parameter> contain the <link linkend="Stringprep-profile"><type>Stringprep_profile</type></link> 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.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>ucs4</parameter> :</term>
<listitem><simpara> input/output array with zero terminated string to prepare.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>maxucs4len</parameter> :</term>
<listitem><simpara> maximum length of input/output array.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter> :</term>
<listitem><simpara> a <link linkend="Stringprep-profile-flags"><type>Stringprep_profile_flags</type></link> value, or 0.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>profile</parameter> :</term>
<listitem><simpara> pointer to <link linkend="Stringprep-profile"><type>Stringprep_profile</type></link> to use.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> Returns <link linkend="STRINGPREP-OK--CAPS"><literal>STRINGPREP_OK</literal></link> iff successful, or an
<link linkend="Stringprep-rc"><type>Stringprep_rc</type></link> error code.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep" role="function">
<title>stringprep ()</title>
<indexterm zone="stringprep"><primary sortas="stringprep">stringprep</primary></indexterm><programlisting><link linkend="int">int</link> stringprep (<link linkend="char">char</link> *in,
<link linkend="size-t">size_t</link> maxlen,
<link linkend="Stringprep-profile-flags">Stringprep_profile_flags</link> flags,
const <link linkend="Stringprep-profile">Stringprep_profile</link> *profile);</programlisting>
<para>
Prepare the input zero terminated UTF-8 string according to the
stringprep profile, and write back the result to the input string.
</para>
<para>
Note that you must convert strings entered in the systems locale
into UTF-8 before using this function, see
<link linkend="stringprep-locale-to-utf8"><function>stringprep_locale_to_utf8()</function></link>.
</para>
<para>
Since the stringprep operation can expand the string, <parameter>maxlen</parameter>
indicate how large the buffer holding the string is. This function
will not read or write to characters outside that size.
</para>
<para>
The <parameter>flags</parameter> are one of <link linkend="Stringprep-profile-flags"><type>Stringprep_profile_flags</type></link> values, or 0.
</para>
<para>
The <parameter>profile</parameter> contain the <link linkend="Stringprep-profile"><type>Stringprep_profile</type></link> 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.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>in</parameter> :</term>
<listitem><simpara> input/ouput array with string to prepare.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>maxlen</parameter> :</term>
<listitem><simpara> maximum length of input/output array.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter> :</term>
<listitem><simpara> a <link linkend="Stringprep-profile-flags"><type>Stringprep_profile_flags</type></link> value, or 0.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>profile</parameter> :</term>
<listitem><simpara> pointer to <link linkend="Stringprep-profile"><type>Stringprep_profile</type></link> to use.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> Returns <link linkend="STRINGPREP-OK--CAPS"><literal>STRINGPREP_OK</literal></link> iff successful, or an error code.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-profile" role="function">
<title>stringprep_profile ()</title>
<indexterm zone="stringprep-profile"><primary sortas="stringprep_profile">stringprep_profile</primary></indexterm><programlisting><link linkend="int">int</link> stringprep_profile (const <link linkend="char">char</link> *in,
<link linkend="char">char</link> **out,
const <link linkend="char">char</link> *profile,
<link linkend="Stringprep-profile-flags">Stringprep_profile_flags</link> flags);</programlisting>
<para>
Prepare the input zero terminated UTF-8 string according to the
stringprep profile, and return the result in a newly allocated
variable.
</para>
<para>
Note that you must convert strings entered in the systems locale
into UTF-8 before using this function, see
<link linkend="stringprep-locale-to-utf8"><function>stringprep_locale_to_utf8()</function></link>.
</para>
<para>
The output <parameter>out</parameter> variable must be deallocated by the caller.
</para>
<para>
The <parameter>flags</parameter> are one of <link linkend="Stringprep-profile-flags"><type>Stringprep_profile_flags</type></link> values, or 0.
</para>
<para>
The <parameter>profile</parameter> specifies the name of the stringprep profile to use.
It must be one of the internally supported stringprep profiles.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>in</parameter> :</term>
<listitem><simpara> input array with UTF-8 string to prepare.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>out</parameter> :</term>
<listitem><simpara> output variable with pointer to newly allocate string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>profile</parameter> :</term>
<listitem><simpara> name of stringprep profile to use.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter> :</term>
<listitem><simpara> a <link linkend="Stringprep-profile-flags"><type>Stringprep_profile_flags</type></link> value, or 0.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> Returns <link linkend="STRINGPREP-OK--CAPS"><literal>STRINGPREP_OK</literal></link> iff successful, or an error code.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-strerror" role="function">
<title>stringprep_strerror ()</title>
<indexterm zone="stringprep-strerror"><primary sortas="stringprep_strerror">stringprep_strerror</primary></indexterm><programlisting>const <link linkend="char">char</link> * stringprep_strerror (<link linkend="Stringprep-rc">Stringprep_rc</link> rc);</programlisting>
<para>
Convert a return code integer to a text string. This string can be
used to output a diagnostic message to the user.
</para>
<para>
STRINGPREP_OK: 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.
STRINGPREP_CONTAINS_UNASSIGNED: String contain unassigned Unicode
code points, which is forbidden by the profile.
STRINGPREP_CONTAINS_PROHIBITED: String contain code points
prohibited by the profile.
STRINGPREP_BIDI_BOTH_L_AND_RAL: String contain code points with
conflicting bidirection category.
STRINGPREP_BIDI_LEADTRAIL_NOT_RAL: Leading and trailing character
in string not of proper bidirectional category.
STRINGPREP_BIDI_CONTAINS_PROHIBITED: Contains prohibited code
points detected by bidirectional code.
STRINGPREP_TOO_SMALL_BUFFER: Buffer handed to function was too
small. This usually indicate a problem in the calling
application.
STRINGPREP_PROFILE_ERROR: The stringprep profile was inconsistent.
This usually indicate an internal error in the library.
STRINGPREP_FLAG_ERROR: The supplied flag conflicted with profile.
This usually indicate a problem in the calling application.
STRINGPREP_UNKNOWN_PROFILE: The supplied profile name was not
known to the library.
STRINGPREP_NFKC_FAILED: The Unicode NFKC operation failed. This
usually indicate an internal error in the library.
STRINGPREP_MALLOC_ERROR: The <link linkend="malloc"><function>malloc()</function></link> was out of memory. This is
usually a fatal error.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>rc</parameter> :</term>
<listitem><simpara> a <link linkend="Stringprep-rc"><type>Stringprep_rc</type></link> return code.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> Returns a pointer to a statically allocated string
containing a description of the error with the return code <parameter>rc</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-check-version" role="function">
<title>stringprep_check_version ()</title>
<indexterm zone="stringprep-check-version"><primary sortas="stringprep_check_version">stringprep_check_version</primary></indexterm><programlisting>const <link linkend="char">char</link> * stringprep_check_version (const <link linkend="char">char</link> *req_version);</programlisting>
<para>
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.
</para>
<para>
See <link linkend="STRINGPREP-VERSION--CAPS"><literal>STRINGPREP_VERSION</literal></link> for a suitable <parameter>req_version</parameter> string.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>req_version</parameter> :</term>
<listitem><simpara> Required version number, or NULL.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> Version string of run-time library, or NULL if the
run-time library does not meet the required version number.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-unichar-to-utf8" role="function">
<title>stringprep_unichar_to_utf8 ()</title>
<indexterm zone="stringprep-unichar-to-utf8"><primary sortas="stringprep_unichar_to_utf8">stringprep_unichar_to_utf8</primary></indexterm><programlisting><link linkend="int">int</link> stringprep_unichar_to_utf8 (<link linkend="uint32-t">uint32_t</link> c,
<link linkend="char">char</link> *outbuf);</programlisting>
<para>
Converts a single character to UTF-8.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>c</parameter> :</term>
<listitem><simpara> a ISO10646 character code
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>outbuf</parameter> :</term>
<listitem><simpara> output buffer, must have at least 6 bytes of space.
If <link linkend="NULL--CAPS"><literal>NULL</literal></link>, the length will be computed and returned
and nothing will be written to <parameter>outbuf</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> number of bytes written.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-utf8-to-unichar" role="function">
<title>stringprep_utf8_to_unichar ()</title>
<indexterm zone="stringprep-utf8-to-unichar"><primary sortas="stringprep_utf8_to_unichar">stringprep_utf8_to_unichar</primary></indexterm><programlisting><link linkend="uint32-t">uint32_t</link> stringprep_utf8_to_unichar (const <link linkend="char">char</link> *p);</programlisting>
<para>
Converts a sequence of bytes encoded as UTF-8 to a Unicode character.
If <parameter>p</parameter> does not point to a valid UTF-8 encoded character, results are
undefined.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>p</parameter> :</term>
<listitem><simpara> a pointer to Unicode character encoded as UTF-8
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the resulting character.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-utf8-to-ucs4" role="function">
<title>stringprep_utf8_to_ucs4 ()</title>
<indexterm zone="stringprep-utf8-to-ucs4"><primary sortas="stringprep_utf8_to_ucs4">stringprep_utf8_to_ucs4</primary></indexterm><programlisting><link linkend="uint32-t">uint32_t</link> * stringprep_utf8_to_ucs4 (const <link linkend="char">char</link> *str,
<link linkend="ssize-t">ssize_t</link> len,
<link linkend="size-t">size_t</link> *items_written);</programlisting>
<para>
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.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter> :</term>
<listitem><simpara> a UTF-8 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter> :</term>
<listitem><simpara> the maximum length of <parameter>str</parameter> to use. If <parameter>len</parameter> < 0, then
the string is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_written</parameter> :</term>
<listitem><simpara> location to store the number of characters in the
result, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a pointer to a newly allocated UCS-4 string.
This value must be deallocated by the caller.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-ucs4-to-utf8" role="function">
<title>stringprep_ucs4_to_utf8 ()</title>
<indexterm zone="stringprep-ucs4-to-utf8"><primary sortas="stringprep_ucs4_to_utf8">stringprep_ucs4_to_utf8</primary></indexterm><programlisting><link linkend="char">char</link> * stringprep_ucs4_to_utf8 (const <link linkend="uint32-t">uint32_t</link> *str,
<link linkend="ssize-t">ssize_t</link> len,
<link linkend="size-t">size_t</link> *items_read,
<link linkend="size-t">size_t</link> *items_written);</programlisting>
<para>
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.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter> :</term>
<listitem><simpara> a UCS-4 encoded string
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter> :</term>
<listitem><simpara> the maximum length of <parameter>str</parameter> to use. If <parameter>len</parameter> < 0, then
the string is terminated with a 0 character.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_read</parameter> :</term>
<listitem><simpara> location to store number of characters read read, or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>items_written</parameter> :</term>
<listitem><simpara> location to store number of bytes written or <link linkend="NULL--CAPS"><literal>NULL</literal></link>.
The value here stored does not include the trailing 0
byte.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a pointer to a newly allocated UTF-8 string.
This value must be deallocated by the caller.
If an error occurs, <link linkend="NULL--CAPS"><literal>NULL</literal></link> will be returned and <parameter>error</parameter>
set.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-utf8-nfkc-normalize" role="function">
<title>stringprep_utf8_nfkc_normalize ()</title>
<indexterm zone="stringprep-utf8-nfkc-normalize"><primary sortas="stringprep_utf8_nfkc_normalize">stringprep_utf8_nfkc_normalize</primary></indexterm><programlisting><link linkend="char">char</link> * stringprep_utf8_nfkc_normalize (const <link linkend="char">char</link> *str,
<link linkend="ssize-t">ssize_t</link> len);</programlisting>
<para>
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.
</para>
<para>
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.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter> :</term>
<listitem><simpara> a UTF-8 encoded string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter> :</term>
<listitem><simpara> length of <parameter>str</parameter>, in bytes, or -1 if <parameter>str</parameter> is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a newly allocated string, that is the
NFKC normalized form of <parameter>str</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-ucs4-nfkc-normalize" role="function">
<title>stringprep_ucs4_nfkc_normalize ()</title>
<indexterm zone="stringprep-ucs4-nfkc-normalize"><primary sortas="stringprep_ucs4_nfkc_normalize">stringprep_ucs4_nfkc_normalize</primary></indexterm><programlisting><link linkend="uint32-t">uint32_t</link> * stringprep_ucs4_nfkc_normalize (<link linkend="uint32-t">uint32_t</link> *str,
<link linkend="ssize-t">ssize_t</link> len);</programlisting>
<para>
Converts UCS4 string into UTF-8 and runs
<link linkend="stringprep-utf8-nfkc-normalize"><function>stringprep_utf8_nfkc_normalize()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter> :</term>
<listitem><simpara> a Unicode string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>len</parameter> :</term>
<listitem><simpara> length of <parameter>str</parameter> array, or -1 if <parameter>str</parameter> is nul-terminated.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a newly allocated Unicode string, that is the NFKC
normalized form of <parameter>str</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-locale-charset" role="function">
<title>stringprep_locale_charset ()</title>
<indexterm zone="stringprep-locale-charset"><primary sortas="stringprep_locale_charset">stringprep_locale_charset</primary></indexterm><programlisting>const <link linkend="char">char</link> * stringprep_locale_charset (void);</programlisting>
<para>
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.
</para>
<para>
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.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> Return the character set used by the current locale.
It will never return NULL, but use "ASCII" as a fallback.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-convert" role="function">
<title>stringprep_convert ()</title>
<indexterm zone="stringprep-convert"><primary sortas="stringprep_convert">stringprep_convert</primary></indexterm><programlisting><link linkend="char">char</link> * stringprep_convert (const <link linkend="char">char</link> *str,
const <link linkend="char">char</link> *to_codeset,
const <link linkend="char">char</link> *from_codeset);</programlisting>
<para>
Convert the string from one character set to another using the
system's <link linkend="iconv"><function>iconv()</function></link> function.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter> :</term>
<listitem><simpara> input zero-terminated string.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>to_codeset</parameter> :</term>
<listitem><simpara> name of destination character set.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>from_codeset</parameter> :</term>
<listitem><simpara> name of origin character set, as used by <parameter>str</parameter>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> Returns newly allocated zero-terminated string which
is <parameter>str</parameter> transcoded into to_codeset.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-locale-to-utf8" role="function">
<title>stringprep_locale_to_utf8 ()</title>
<indexterm zone="stringprep-locale-to-utf8"><primary sortas="stringprep_locale_to_utf8">stringprep_locale_to_utf8</primary></indexterm><programlisting><link linkend="char">char</link> * stringprep_locale_to_utf8 (const <link linkend="char">char</link> *str);</programlisting>
<para>
Convert string encoded in the locale's character set into UTF-8 by
using <link linkend="stringprep-convert"><function>stringprep_convert()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter> :</term>
<listitem><simpara> input zero terminated string.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> Returns newly allocated zero-terminated string which
is <parameter>str</parameter> transcoded into UTF-8.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="stringprep-utf8-to-locale" role="function">
<title>stringprep_utf8_to_locale ()</title>
<indexterm zone="stringprep-utf8-to-locale"><primary sortas="stringprep_utf8_to_locale">stringprep_utf8_to_locale</primary></indexterm><programlisting><link linkend="char">char</link> * stringprep_utf8_to_locale (const <link linkend="char">char</link> *str);</programlisting>
<para>
Convert string encoded in UTF-8 into the locale's character set by
using <link linkend="stringprep-convert"><function>stringprep_convert()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>str</parameter> :</term>
<listitem><simpara> input zero terminated string.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> Returns newly allocated zero-terminated string which
is <parameter>str</parameter> transcoded into the locale's character set.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>
</refentry>
|