/usr/share/doc/enca/html/libenca/libenca-Analyser.html is in libenca-dev 1.13-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Analyser</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Enca Library Reference Manual">
<link rel="up" href="ch01.html" title="Enca Library API">
<link rel="prev" href="ch01.html" title="Enca Library API">
<link rel="next" href="libenca-Typedefs-and-Constants.html" title="Typedefs and Constants">
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="ch01.html" title="Enca Library API">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="ch01.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">Enca Library Reference Manual</th>
<td><a accesskey="n" href="libenca-Typedefs-and-Constants.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#libenca-Analyser.synopsis" class="shortcut">Top</a>
|
<a href="#libenca-Analyser.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" title="Analyser">
<a name="libenca-Analyser"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libenca-Analyser.top_of_page"></a>Analyser</span></h2>
<p>Analyser — Basic analyser interface.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv" title="Synopsis">
<a name="libenca-Analyser.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
EncaAnalyser <a class="link" href="libenca-Analyser.html#enca-analyser-alloc" title="enca_analyser_alloc ()">enca_analyser_alloc</a> (const char *langname);
void <a class="link" href="libenca-Analyser.html#enca-analyser-free" title="enca_analyser_free ()">enca_analyser_free</a> (EncaAnalyser analyser);
<a class="link" href="libenca-Typedefs-and-Constants.html#EncaEncoding" title="EncaEncoding">EncaEncoding</a> <a class="link" href="libenca-Analyser.html#enca-analyse" title="enca_analyse ()">enca_analyse</a> (EncaAnalyser analyser,
unsigned char *buffer,
size_t size);
<a class="link" href="libenca-Typedefs-and-Constants.html#EncaEncoding" title="EncaEncoding">EncaEncoding</a> <a class="link" href="libenca-Analyser.html#enca-analyse-const" title="enca_analyse_const ()">enca_analyse_const</a> (EncaAnalyser analyser,
unsigned char *buffer,
size_t size);
int <a class="link" href="libenca-Analyser.html#enca-errno" title="enca_errno ()">enca_errno</a> (EncaAnalyser analyser);
const char* <a class="link" href="libenca-Analyser.html#enca-strerror" title="enca_strerror ()">enca_strerror</a> (EncaAnalyser analyser,
int errnum);
int <a class="link" href="libenca-Analyser.html#enca-double-utf8-check" title="enca_double_utf8_check ()">enca_double_utf8_check</a> (EncaAnalyser analyser,
unsigned char *buffer,
size_t size);
int* <a class="link" href="libenca-Analyser.html#enca-double-utf8-get-candidates" title="enca_double_utf8_get_candidates ()">enca_double_utf8_get_candidates</a> (EncaAnalyser analyser);
void <a class="link" href="libenca-Analyser.html#enca-set-multibyte" title="enca_set_multibyte ()">enca_set_multibyte</a> (EncaAnalyser analyser,
int multibyte);
int <a class="link" href="libenca-Analyser.html#enca-get-multibyte" title="enca_get_multibyte ()">enca_get_multibyte</a> (EncaAnalyser analyser);
void <a class="link" href="libenca-Analyser.html#enca-set-interpreted-surfaces" title="enca_set_interpreted_surfaces ()">enca_set_interpreted_surfaces</a> (EncaAnalyser analyser,
int interpreted_surfaces);
int <a class="link" href="libenca-Analyser.html#enca-get-interpreted-surfaces" title="enca_get_interpreted_surfaces ()">enca_get_interpreted_surfaces</a> (EncaAnalyser analyser);
void <a class="link" href="libenca-Analyser.html#enca-set-ambiguity" title="enca_set_ambiguity ()">enca_set_ambiguity</a> (EncaAnalyser analyser,
int ambiguity);
int <a class="link" href="libenca-Analyser.html#enca-get-ambiguity" title="enca_get_ambiguity ()">enca_get_ambiguity</a> (EncaAnalyser analyser);
void <a class="link" href="libenca-Analyser.html#enca-set-filtering" title="enca_set_filtering ()">enca_set_filtering</a> (EncaAnalyser analyser,
int filtering);
int <a class="link" href="libenca-Analyser.html#enca-get-filtering" title="enca_get_filtering ()">enca_get_filtering</a> (EncaAnalyser analyser);
void <a class="link" href="libenca-Analyser.html#enca-set-garbage-test" title="enca_set_garbage_test ()">enca_set_garbage_test</a> (EncaAnalyser analyser,
int garabage_test);
int <a class="link" href="libenca-Analyser.html#enca-get-garbage-test" title="enca_get_garbage_test ()">enca_get_garbage_test</a> (EncaAnalyser analyser);
void <a class="link" href="libenca-Analyser.html#enca-set-termination-strictness" title="enca_set_termination_strictness ()">enca_set_termination_strictness</a> (EncaAnalyser analyser,
int termination_strictness);
int <a class="link" href="libenca-Analyser.html#enca-get-termination-strictness" title="enca_get_termination_strictness ()">enca_get_termination_strictness</a> (EncaAnalyser analyser);
int <a class="link" href="libenca-Analyser.html#enca-set-significant" title="enca_set_significant ()">enca_set_significant</a> (EncaAnalyser analyser,
size_t significant);
size_t <a class="link" href="libenca-Analyser.html#enca-get-significant" title="enca_get_significant ()">enca_get_significant</a> (EncaAnalyser analyser);
int <a class="link" href="libenca-Analyser.html#enca-set-threshold" title="enca_set_threshold ()">enca_set_threshold</a> (EncaAnalyser analyser,
double threshold);
double <a class="link" href="libenca-Analyser.html#enca-get-threshold" title="enca_get_threshold ()">enca_get_threshold</a> (EncaAnalyser analyser);
</pre>
</div>
<div class="refsect1" title="Description">
<a name="libenca-Analyser.description"></a><h2>Description</h2>
<p>
Basically you want to allocate an analyser with <a class="link" href="libenca-Analyser.html#enca-analyser-alloc" title="enca_analyser_alloc ()"><code class="function">enca_analyser_alloc()</code></a> for some
language, use <a class="link" href="libenca-Analyser.html#enca-analyse" title="enca_analyse ()"><code class="function">enca_analyse()</code></a> (or <a class="link" href="libenca-Analyser.html#enca-analyse-const" title="enca_analyse_const ()"><code class="function">enca_analyse_const()</code></a>) on a buffer to find its
encoding, and interpret the results with something like <a class="link" href="libenca-Charsets-and-Surfaces.html#enca-charset-name" title="enca_charset_name ()"><code class="function">enca_charset_name()</code></a>.
The analyser then can be used for another buffer. Once you no longer need
it, call <a class="link" href="libenca-Analyser.html#enca-analyser-free" title="enca_analyser_free ()"><code class="function">enca_analyser_free()</code></a> to release it.
</p>
<p>
A single working example is better than a hundred pages of reference manual.
</p>
<div class="example">
<a name="id341782"></a><p class="title"><b>Example 1. A minimal Enca library application – Czech encoding
detector.</b></p>
<div class="example-contents"><pre class="programlisting">
#include <stdio.h>
#include <enca.h>
int
main(void)
{
EncaAnalyser analyser;
EncaEncoding encoding;
unsigned char buffer[4096];
size_t buflen;
buflen = fread(buffer, 1, 4096, stdin);
analyser = enca_analyser_alloc("cs");
encoding = enca_analyse(analyser, buffer, buflen);
printf("Charset: %%s\n", enca_charset_name(encoding.charset,
ENCA_NAME_STYLE_HUMAN));
enca_analyser_free(analyser);
return 0;
}
</pre></div>
</div>
<br class="example-break"><p>
The analyser has plenty of options, but generally you don't need to fiddle
with them, except <a class="link" href="libenca-Analyser.html#enca-set-termination-strictness" title="enca_set_termination_strictness ()"><code class="function">enca_set_termination_strictness()</code></a>.
</p>
<p>
All names prefixed with <code class="function">ENCA_</code>,
<code class="function">Enca</code>, <code class="function">_Enca</code>,
or <code class="function">enca_</code> should be treated as reserved and not used for
application function/variable/type/macro names.
</p>
</div>
<div class="refsect1" title="Details">
<a name="libenca-Analyser.details"></a><h2>Details</h2>
<div class="refsect2" title="enca_analyser_alloc ()">
<a name="enca-analyser-alloc"></a><h3>enca_analyser_alloc ()</h3>
<pre class="programlisting">EncaAnalyser enca_analyser_alloc (const char *langname);</pre>
<p>
Allocates an analyser and initializes it for language <em class="parameter"><code>language</code></em>.
</p>
<p>
The analyser, once crerated, can be used only for language for which it
was initialized. If you need to detect encodings of texts in more than one
language, you must allocate an analyser for each one. Note however, an
analyser may occupy a considerable amount of memory (a few hundreds of kB),
so it's generally not a good idea to have several hundreds of them floating
around.
</p>
<p>
<em class="parameter"><code>langname</code></em> is two-letter ISO 639:1989 language code. Locale names in form
language_territory and ISO-639 English language names also may be accepted
in the future. To be on the safe side, use only names returned by
<a class="link" href="libenca-Auxiliary-Functions.html#enca-get-languages" title="enca_get_languages ()"><code class="function">enca_get_languages()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>langname</code></em> :</span></p></td>
<td> Language for which the analyser should be initialized.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The newly created <span class="type">EncaAnalyser</span> on success, <span class="type">NULL</span> on failure
(namely when <em class="parameter"><code>langname</code></em> is unknown or otherwise invalid).
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_analyser_free ()">
<a name="enca-analyser-free"></a><h3>enca_analyser_free ()</h3>
<pre class="programlisting">void enca_analyser_free (EncaAnalyser analyser);</pre>
<p>
Frees memory used by <span class="type">EncaAnalyser</span> <em class="parameter"><code>analyser</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser to be destroyed.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_analyse ()">
<a name="enca-analyse"></a><h3>enca_analyse ()</h3>
<pre class="programlisting"><a class="link" href="libenca-Typedefs-and-Constants.html#EncaEncoding" title="EncaEncoding">EncaEncoding</a> enca_analyse (EncaAnalyser analyser,
unsigned char *buffer,
size_t size);</pre>
<p>
Analyses <em class="parameter"><code>buffer</code></em> and finds its encoding.
</p>
<p>
The <em class="parameter"><code>buffer</code></em> is checked for 8bit encodings of language for which <em class="parameter"><code>analyser</code></em>
was initialized and for multibyte encodings, mostly independent on language
(unless disabled with <a class="link" href="libenca-Analyser.html#enca-set-multibyte" title="enca_set_multibyte ()"><code class="function">enca_set_multibyte()</code></a>).
</p>
<p>
The contents of <em class="parameter"><code>buffer</code></em> may be (and probably will be) modified during the
analyse. Use <a class="link" href="libenca-Analyser.html#enca-analyse-const" title="enca_analyse_const ()"><code class="function">enca_analyse_const()</code></a> instead if this discomforts you.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser initialized for some language.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
<td> Buffer to be analysed.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
<td> Size of <em class="parameter"><code>buffer</code></em>.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Encoding of <em class="parameter"><code>buffer</code></em>. When charset part of return value is
<a class="link" href="libenca-Typedefs-and-Constants.html#ENCA-CS-UNKNOWN--CAPS" title="ENCA_CS_UNKNOWN"><span class="type">ENCA_CS_UNKNOWN</span></a>, encoding was not determined. Check
<a class="link" href="libenca-Analyser.html#enca-errno" title="enca_errno ()"><code class="function">enca_errno()</code></a> for reason.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_analyse_const ()">
<a name="enca-analyse-const"></a><h3>enca_analyse_const ()</h3>
<pre class="programlisting"><a class="link" href="libenca-Typedefs-and-Constants.html#EncaEncoding" title="EncaEncoding">EncaEncoding</a> enca_analyse_const (EncaAnalyser analyser,
unsigned char *buffer,
size_t size);</pre>
<p>
Analyses <em class="parameter"><code>buffer</code></em> and finds its encoding.
</p>
<p>
The <em class="parameter"><code>buffer</code></em> is checked for 8bit encodings of language for which <em class="parameter"><code>analyser</code></em>
was initialized and for multibyte encodings, mostly independent on language
(unless disabled with <a class="link" href="libenca-Analyser.html#enca-set-multibyte" title="enca_set_multibyte ()"><code class="function">enca_set_multibyte()</code></a>).
</p>
<p>
This function never modifies <em class="parameter"><code>buffer</code></em> (can be even used with string literal
<em class="parameter"><code>buffer</code></em>) at the expense it's generally slower than <a class="link" href="libenca-Analyser.html#enca-analyse" title="enca_analyse ()"><code class="function">enca_analyse()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser initialized for some language.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
<td> Buffer to be analysed.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
<td> Size of <em class="parameter"><code>buffer</code></em>.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Encoding of <em class="parameter"><code>buffer</code></em>. When charset part of return value is
<a class="link" href="libenca-Typedefs-and-Constants.html#ENCA-CS-UNKNOWN--CAPS" title="ENCA_CS_UNKNOWN"><span class="type">ENCA_CS_UNKNOWN</span></a>, encoding was not determined. Check
<a class="link" href="libenca-Analyser.html#enca-errno" title="enca_errno ()"><code class="function">enca_errno()</code></a> for reason.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_errno ()">
<a name="enca-errno"></a><h3>enca_errno ()</h3>
<pre class="programlisting">int enca_errno (EncaAnalyser analyser);</pre>
<p>
Returns analyser error code.
</p>
<p>
The error code is not modified. However, any other analyser call i.e.
call to a function taking <em class="parameter"><code>analyser</code></em> as parameter can change the error code.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Error code of reason why last analyser call failed.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_strerror ()">
<a name="enca-strerror"></a><h3>enca_strerror ()</h3>
<pre class="programlisting">const char* enca_strerror (EncaAnalyser analyser,
int errnum);</pre>
<p>
Returns string describing the error code.
</p>
<p>
The returned string must be considered constant and must NOT be freed.
It is however gauranteed not to be modified on invalidated by subsequent
calls to any libenca functions, including <a class="link" href="libenca-Analyser.html#enca-strerror" title="enca_strerror ()"><code class="function">enca_strerror()</code></a>.
</p>
<p>
The analyser error code is not changed for a successful call, and it set
to <a class="link" href="libenca-Typedefs-and-Constants.html#ENCA-EINVALUE--CAPS"><span class="type">ENCA_EINVALUE</span></a> upon error.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>errnum</code></em> :</span></p></td>
<td> An analyser error code.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> String describing the error code.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_double_utf8_check ()">
<a name="enca-double-utf8-check"></a><h3>enca_double_utf8_check ()</h3>
<pre class="programlisting">int enca_double_utf8_check (EncaAnalyser analyser,
unsigned char *buffer,
size_t size);</pre>
<p>
Checks buffer for double-UTF-8 encoding.
</p>
<p>
Double-UTF-8 encoding is the result of [errorneous] conversion of UTF-8 text
to UTF-8 again, as if it was in some 8bit charset. This is quite hard to
recover from.
</p>
<p>
The analayser mostly only determines what language will be assumed,
the rest of this test is independent on the main guessing routines.
When <em class="parameter"><code>buffer</code></em> doesn't containing UTF-8 text, the result is undefined
(namely, false positives are possible).
</p>
<p>
Calling this function when language is `none' has currently no effect.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> Analyzer state determinig the language for double-UTF-8 check.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>buffer</code></em> :</span></p></td>
<td> The buffer to be checked [<em class="parameter"><code>size</code></em>].
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>size</code></em> :</span></p></td>
<td> The size of <em class="parameter"><code>buffer</code></em>.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Nonzero, when <em class="parameter"><code>buffer</code></em> probably contains doubly-UTF-8 encoded text.
More precisely, it returns the number of charsets which are
possible candidates for source charset. You can then use
<a class="link" href="libenca-Analyser.html#enca-double-utf8-get-candidates" title="enca_double_utf8_get_candidates ()"><code class="function">enca_double_utf8_get_candidates()</code></a> to retrieve the charsets.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_double_utf8_get_candidates ()">
<a name="enca-double-utf8-get-candidates"></a><h3>enca_double_utf8_get_candidates ()</h3>
<pre class="programlisting">int* enca_double_utf8_get_candidates (EncaAnalyser analyser);</pre>
<p>
Returns array of double-UTF-8 source charset candidates from the last check.
</p>
<p>
The returned array should be freed by caller then no longer needed. Its
is the return value of the preceding <a class="link" href="libenca-Analyser.html#enca-double-utf8-check" title="enca_double_utf8_check ()"><code class="function">enca_double_utf8_check()</code></a> call.
</p>
<p>
When called before any double-UTF-8 test has been performed yet or after
and unsuccessfull double-UTF-8 test, it returns NULL, but the result after
an unsuccessfull check should be considered undefined.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> Analyzer state for which double-UTF-8 candidates are to be
returned.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> An array containing charset id's of possible source charsets from
which the sample was doubly-UTF-8 encoded. The array may contain
only one value, but usually enca is not able to decide between
e.g. ISO-8859-2 and Win1250, thus more candidates are returned.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_set_multibyte ()">
<a name="enca-set-multibyte"></a><h3>enca_set_multibyte ()</h3>
<pre class="programlisting">void enca_set_multibyte (EncaAnalyser analyser,
int multibyte);</pre>
<p>
Enables or disables multibyte encoding tests for <em class="parameter"><code>analyser</code></em>.
</p>
<p>
This option is enabled by default.
</p>
<p>
When multibyte encodings are disabled, only 8bit charsets are checked.
Disabling them for language with no 8bit charsets leaves only one thing
<a class="link" href="libenca-Analyser.html#enca-analyse" title="enca_analyse ()"><code class="function">enca_analyse()</code></a> could test: whether the sample is purely 7bit ASCII or not
(the latter leading to analyser failure, of course).
</p>
<p>
Multibyte encoding detection is also affected by
<a class="link" href="libenca-Analyser.html#enca-set-termination-strictness" title="enca_set_termination_strictness ()"><code class="function">enca_set_termination_strictness()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>multibyte</code></em> :</span></p></td>
<td> Whether multibyte encoding tests should be enabled (nonzero to
enable, zero to disable).
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_get_multibyte ()">
<a name="enca-get-multibyte"></a><h3>enca_get_multibyte ()</h3>
<pre class="programlisting">int enca_get_multibyte (EncaAnalyser analyser);</pre>
<p>
Returns whether <em class="parameter"><code>analyser</code></em> can return multibyte encodings.
</p>
<p>
See <a class="link" href="libenca-Analyser.html#enca-set-multibyte" title="enca_set_multibyte ()"><code class="function">enca_set_multibyte()</code></a> for more detailed description of multibyte
encoding checking.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Nonzero when multibyte encoding are possible, zero otherwise.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.3.</p>
</div>
<hr>
<div class="refsect2" title="enca_set_interpreted_surfaces ()">
<a name="enca-set-interpreted-surfaces"></a><h3>enca_set_interpreted_surfaces ()</h3>
<pre class="programlisting">void enca_set_interpreted_surfaces (EncaAnalyser analyser,
int interpreted_surfaces);</pre>
<p>
Enables or disables interpeted surfaces tests for <em class="parameter"><code>analyser</code></em>.
</p>
<p>
This option is enabled by default.
</p>
<p>
To allow simple applications which care about charset only and don't want
to wrestle with surfaces, neglecting surface information should not have
serious consequences. While ignoring EOL type surface is feasible, and
ignoring UCS byteorders may be acceptable in endian-homogenous environment;
ignoring the fact file is Quoted-Printable encoded can have disasterous
consequences. By disabling this option you can disable surfaces requiring
fundamental reinterpretation of the content, namely <a class="link" href="libenca-Typedefs-and-Constants.html#ENCA-SURFACE-QP--CAPS"><code class="literal">ENCA_SURFACE_QP</code></a>
and <a class="link" href="libenca-Typedefs-and-Constants.html#ENCA-SURFACE-EOL-BIN--CAPS"><code class="literal">ENCA_SURFACE_EOL_BIN</code></a> (thus probably making <a class="link" href="libenca-Analyser.html#enca-analyse" title="enca_analyse ()"><code class="function">enca_analyse()</code></a> to fail on
such samples).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>interpreted_surfaces</code></em> :</span></p></td>
<td> Whether interpreted surfaces tests should be enabled
(nonzero to allow, zero to disallow).
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_get_interpreted_surfaces ()">
<a name="enca-get-interpreted-surfaces"></a><h3>enca_get_interpreted_surfaces ()</h3>
<pre class="programlisting">int enca_get_interpreted_surfaces (EncaAnalyser analyser);</pre>
<p>
Returns whether <em class="parameter"><code>analyser</code></em> allows interpreted surfaces.
</p>
<p>
See <a class="link" href="libenca-Analyser.html#enca-set-interpreted-surfaces" title="enca_set_interpreted_surfaces ()"><code class="function">enca_set_interpreted_surfaces()</code></a> for more detailed description of
interpreted surfaces.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Nonzero when interpreted surfaces are possible, zero otherwise.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.3.</p>
</div>
<hr>
<div class="refsect2" title="enca_set_ambiguity ()">
<a name="enca-set-ambiguity"></a><h3>enca_set_ambiguity ()</h3>
<pre class="programlisting">void enca_set_ambiguity (EncaAnalyser analyser,
int ambiguity);</pre>
<p>
Enables or disables ambiguous mode for <em class="parameter"><code>analyser</code></em>.
</p>
<p>
This option is disabled by default.
</p>
<p>
In ambiguous mode some result is returned even when the charset cannot be
determined uniquely, provided that sample contains only characters which
have the same meaning in all charsets under consideration.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ambiguity</code></em> :</span></p></td>
<td> Whether result can be ambiguous (nonzero to allow, zero to
disallow).
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_get_ambiguity ()">
<a name="enca-get-ambiguity"></a><h3>enca_get_ambiguity ()</h3>
<pre class="programlisting">int enca_get_ambiguity (EncaAnalyser analyser);</pre>
<p>
Returns whether <em class="parameter"><code>analyser</code></em> can return ambiguous results.
</p>
<p>
See <a class="link" href="libenca-Analyser.html#enca-set-ambiguity" title="enca_set_ambiguity ()"><code class="function">enca_set_ambiguity()</code></a> for more detailed description of ambiguous results.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Nonzero when ambiguous results are allowed, zero otherwise.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.3.</p>
</div>
<hr>
<div class="refsect2" title="enca_set_filtering ()">
<a name="enca-set-filtering"></a><h3>enca_set_filtering ()</h3>
<pre class="programlisting">void enca_set_filtering (EncaAnalyser analyser,
int filtering);</pre>
<p>
Enables or disables filters for <em class="parameter"><code>analyser</code></em>.
</p>
<p>
This option is enabled by default.
</p>
<p>
Various filters are used to filter out block of binary noise and box-drawing
characters that could otherwise confuse enca. In cases this is unwanted,
you can disable them by setting this option to zero.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>filtering</code></em> :</span></p></td>
<td> Whether filters should be enabled (nonzero to enable, zero to
disable).
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_get_filtering ()">
<a name="enca-get-filtering"></a><h3>enca_get_filtering ()</h3>
<pre class="programlisting">int enca_get_filtering (EncaAnalyser analyser);</pre>
<p>
Returns whether <em class="parameter"><code>analyser</code></em> has filtering enabled.
</p>
<p>
See <a class="link" href="libenca-Analyser.html#enca-set-filtering" title="enca_set_filtering ()"><code class="function">enca_set_filtering()</code></a> for more detailed description of filtering.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Nonzero when filtering is enabled, zero otherwise.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.3.</p>
</div>
<hr>
<div class="refsect2" title="enca_set_garbage_test ()">
<a name="enca-set-garbage-test"></a><h3>enca_set_garbage_test ()</h3>
<pre class="programlisting">void enca_set_garbage_test (EncaAnalyser analyser,
int garabage_test);</pre>
<p>
Enables or disables garbage test for <em class="parameter"><code>analyser</code></em>.
</p>
<p>
This option is enabled by default.
</p>
<p>
To prevent white noise (and almost-white noise) from being accidentally
detected as some charset, a garbage test is used. In cases this is
unwanted, you can disable is by setting this option to zero.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>garabage_test</code></em> :</span></p></td>
<td> Whether garbage test should be allowed (nonzero to enable,
nzero to disable).
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_get_garbage_test ()">
<a name="enca-get-garbage-test"></a><h3>enca_get_garbage_test ()</h3>
<pre class="programlisting">int enca_get_garbage_test (EncaAnalyser analyser);</pre>
<p>
Returns whether <em class="parameter"><code>analyser</code></em> has garbage test enabled.
</p>
<p>
See <a class="link" href="libenca-Analyser.html#enca-set-garbage-test" title="enca_set_garbage_test ()"><code class="function">enca_set_garbage_test()</code></a> for more detailed description of garbage test.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Nonzero when garbage test is enabled, zero otherwise.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.3.</p>
</div>
<hr>
<div class="refsect2" title="enca_set_termination_strictness ()">
<a name="enca-set-termination-strictness"></a><h3>enca_set_termination_strictness ()</h3>
<pre class="programlisting">void enca_set_termination_strictness (EncaAnalyser analyser,
int termination_strictness);</pre>
<p>
Enables or disables requiring multibyte sequences to be terminated correctly
at the end of sample.
</p>
<p>
This option is enabled by default.
</p>
<p>
The sample given to <a class="link" href="libenca-Analyser.html#enca-analyse" title="enca_analyse ()"><code class="function">enca_analyse()</code></a> generally may not be a complete text
(e.g. for efficiency reasons). As a result, it may end in the middle of a
multibyte sequence. In this case, you should disable this option to
prevent rejecting some charset just because the sample don't terminate
correctly. On the other hand, when given sample contains whole text, you
should always enable this option to assure correctness of the result.
</p>
<p>
Note this option does NOT affect fixed character size encodings, like UCS-2
and UCS-4; sample is never assumed to contain UCS-2 text when its size is
not even (and similarly for UCS-4).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>termination_strictness</code></em> :</span></p></td>
<td> Whether multibyte sequences are required to be
terminated correctly at the end of sample
(nonzero to require, zero to relax).
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_get_termination_strictness ()">
<a name="enca-get-termination-strictness"></a><h3>enca_get_termination_strictness ()</h3>
<pre class="programlisting">int enca_get_termination_strictness (EncaAnalyser analyser);</pre>
<p>
Returns whether <em class="parameter"><code>analyser</code></em> requires strict termination.
</p>
<p>
See <a class="link" href="libenca-Analyser.html#enca-set-termination-strictness" title="enca_set_termination_strictness ()"><code class="function">enca_set_termination_strictness()</code></a> for more detailed description of
termination strictness.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Nonzero when strict termination is required, zero otherwise.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.3.</p>
</div>
<hr>
<div class="refsect2" title="enca_set_significant ()">
<a name="enca-set-significant"></a><h3>enca_set_significant ()</h3>
<pre class="programlisting">int enca_set_significant (EncaAnalyser analyser,
size_t significant);</pre>
<p>
Sets the minimal number of required significant characters.
</p>
<p>
The default value of this option is 10.
</p>
<p>
<a class="link" href="libenca-Analyser.html#enca-analyse" title="enca_analyse ()"><code class="function">enca_analyse()</code></a> refuses to make a decision unles at least this number
of significant characters is found in sample. You may want to lower this
number for very short texts.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>significant</code></em> :</span></p></td>
<td> Minimal number of required significant characters.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Zero on success, nonzero on failure, i.e. when you passed zero
as <em class="parameter"><code>significant</code></em>. It sets analyser errno to ENCA_EINVALUE on
failure.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_get_significant ()">
<a name="enca-get-significant"></a><h3>enca_get_significant ()</h3>
<pre class="programlisting">size_t enca_get_significant (EncaAnalyser analyser);</pre>
<p>
Returns the minimum number of significant characters required by <em class="parameter"><code>analyser</code></em>.
</p>
<p>
See <a class="link" href="libenca-Analyser.html#enca-set-significant" title="enca_set_significant ()"><code class="function">enca_set_significant()</code></a> for more detailed description of required
significant characters.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The minimum number of significant characters.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.3.</p>
</div>
<hr>
<div class="refsect2" title="enca_set_threshold ()">
<a name="enca-set-threshold"></a><h3>enca_set_threshold ()</h3>
<pre class="programlisting">int enca_set_threshold (EncaAnalyser analyser,
double threshold);</pre>
<p>
Sets the minimal ratio between the most probable and the second most
probable charsets.
</p>
<p>
The default value of this option is 1.4142.
</p>
<p>
<a class="link" href="libenca-Analyser.html#enca-analyse" title="enca_analyse ()"><code class="function">enca_analyse()</code></a> consideres the result known only when there's a clear gap
between the most probable and the second most probable charset
proababilities. Lower <em class="parameter"><code>threshold</code></em> values mean larger probability of a
mistake and smaller probability of not recognizing a charset; higher
<em class="parameter"><code>threshold</code></em> values the contrary. Threshold value of 2 is almost infinity.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>threshold</code></em> :</span></p></td>
<td> Minimal ratio between winner and second best guess.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> Zero on success, nonzero on failure, i.e. when you passed value
smaller than 1.0 as <em class="parameter"><code>threshold</code></em>. It sets analyser errno to
ENCA_EINVALUE on failure.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" title="enca_get_threshold ()">
<a name="enca-get-threshold"></a><h3>enca_get_threshold ()</h3>
<pre class="programlisting">double enca_get_threshold (EncaAnalyser analyser);</pre>
<p>
Returns the threshold value used by <em class="parameter"><code>analyser</code></em>.
</p>
<p>
See <a class="link" href="libenca-Analyser.html#enca-set-threshold" title="enca_set_threshold ()"><code class="function">enca_set_threshold()</code></a> for more detailed threshold description.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>analyser</code></em> :</span></p></td>
<td> An analyser.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> The threshold value.
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 1.3.</p>
</div>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.11</div>
</body>
</html>
|