| 737 |
<a name="localesupport"></a></P> |
<a name="localesupport"></a></P> |
| 738 |
<br><a name="SEC10" href="#TOC1">LOCALE SUPPORT</a><br> |
<br><a name="SEC10" href="#TOC1">LOCALE SUPPORT</a><br> |
| 739 |
<P> |
<P> |
| 740 |
PCRE handles caseless matching, and determines whether characters are letters |
PCRE handles caseless matching, and determines whether characters are letters, |
| 741 |
digits, or whatever, by reference to a set of tables, indexed by character |
digits, or whatever, by reference to a set of tables, indexed by character |
| 742 |
value. When running in UTF-8 mode, this applies only to characters with codes |
value. When running in UTF-8 mode, this applies only to characters with codes |
| 743 |
less than 128. Higher-valued codes never match escapes such as \w or \d, but |
less than 128. Higher-valued codes never match escapes such as \w or \d, but |
| 744 |
can be tested with \p if PCRE is built with Unicode character property |
can be tested with \p if PCRE is built with Unicode character property |
| 745 |
support. The use of locales with Unicode is discouraged. |
support. The use of locales with Unicode is discouraged. If you are handling |
| 746 |
</P> |
characters with codes greater than 128, you should either use UTF-8 and |
| 747 |
<P> |
Unicode, or use locales, but not try to mix the two. |
| 748 |
An internal set of tables is created in the default C locale when PCRE is |
</P> |
| 749 |
built. This is used when the final argument of <b>pcre_compile()</b> is NULL, |
<P> |
| 750 |
and is sufficient for many applications. An alternative set of tables can, |
PCRE contains an internal set of tables that are used when the final argument |
| 751 |
however, be supplied. These may be created in a different locale from the |
of <b>pcre_compile()</b> is NULL. These are sufficient for many applications. |
| 752 |
default. As more and more applications change to using Unicode, the need for |
Normally, the internal tables recognize only ASCII characters. However, when |
| 753 |
this locale support is expected to die away. |
PCRE is built, it is possible to cause the internal tables to be rebuilt in the |
| 754 |
|
default "C" locale of the local system, which may cause them to be different. |
| 755 |
|
</P> |
| 756 |
|
<P> |
| 757 |
|
The internal tables can always be overridden by tables supplied by the |
| 758 |
|
application that calls PCRE. These may be created in a different locale from |
| 759 |
|
the default. As more and more applications change to using Unicode, the need |
| 760 |
|
for this locale support is expected to die away. |
| 761 |
</P> |
</P> |
| 762 |
<P> |
<P> |
| 763 |
External tables are built by calling the <b>pcre_maketables()</b> function, |
External tables are built by calling the <b>pcre_maketables()</b> function, |
| 771 |
tables = pcre_maketables(); |
tables = pcre_maketables(); |
| 772 |
re = pcre_compile(..., tables); |
re = pcre_compile(..., tables); |
| 773 |
</pre> |
</pre> |
| 774 |
|
The locale name "fr_FR" is used on Linux and other Unix-like systems; if you |
| 775 |
|
are using Windows, the name for the French locale is "french". |
| 776 |
|
</P> |
| 777 |
|
<P> |
| 778 |
When <b>pcre_maketables()</b> runs, the tables are built in memory that is |
When <b>pcre_maketables()</b> runs, the tables are built in memory that is |
| 779 |
obtained via <b>pcre_malloc</b>. It is the caller's responsibility to ensure |
obtained via <b>pcre_malloc</b>. It is the caller's responsibility to ensure |
| 780 |
that the memory containing the tables remains available for as long as it is |
that the memory containing the tables remains available for as long as it is |