This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Unicode::Collate v0.09
[perl5.git] / pod / perlunicode.pod
CommitLineData
393fec97
GS
1=head1 NAME
2
3perlunicode - Unicode support in Perl
4
5=head1 DESCRIPTION
6
0a1f2d14 7=head2 Important Caveats
21bad921 8
776f8809
JH
9WARNING: While the implementation of Unicode support in Perl is now
10fairly complete it is still evolving to some extent.
21bad921 11
75daf61c
JH
12In particular the way Unicode is handled on EBCDIC platforms is still
13rather experimental. On such a platform references to UTF-8 encoding
14in this document and elsewhere should be read as meaning UTF-EBCDIC as
15specified in Unicode Technical Report 16 unless ASCII vs EBCDIC issues
16are specifically discussed. There is no C<utfebcdic> pragma or
17":utfebcdic" layer, rather "utf8" and ":utf8" are re-used to mean
18platform's "natural" 8-bit encoding of Unicode. See L<perlebcdic> for
19more discussion of the issues.
0a1f2d14
NIS
20
21The following areas are still under development.
21bad921 22
13a2d996 23=over 4
21bad921
GS
24
25=item Input and Output Disciplines
26
75daf61c
JH
27A filehandle can be marked as containing perl's internal Unicode
28encoding (UTF-8 or UTF-EBCDIC) by opening it with the ":utf8" layer.
0a1f2d14 29Other encodings can be converted to perl's encoding on input, or from
75daf61c
JH
30perl's encoding on output by use of the ":encoding()" layer. There is
31not yet a clean way to mark the Perl source itself as being in an
32particular encoding.
21bad921
GS
33
34=item Regular Expressions
35
e6739005
JH
36The regular expression compiler does now attempt to produce
37polymorphic opcodes. That is the pattern should now adapt to the data
75daf61c
JH
38and automatically switch to the Unicode character scheme when
39presented with Unicode data, or a traditional byte scheme when
40presented with byte data. The implementation is still new and
41(particularly on EBCDIC platforms) may need further work.
21bad921 42
ad0029c4 43=item C<use utf8> still needed to enable UTF-8/UTF-EBCDIC in scripts
21bad921 44
75daf61c
JH
45The C<utf8> pragma implements the tables used for Unicode support.
46These tables are automatically loaded on demand, so the C<utf8> pragma
47need not normally be used.
21bad921 48
75daf61c 49However, as a compatibility measure, this pragma must be explicitly
ad0029c4
JH
50used to enable recognition of UTF-8 in the Perl scripts themselves on
51ASCII based machines or recognize UTF-EBCDIC on EBCDIC based machines.
7dedd01f
JH
52B<NOTE: this should be the only place where an explicit C<use utf8> is
53needed>.
21bad921 54
1768d7eb 55You can also use the C<encoding> pragma to change the default encoding
6ec9efec 56of the data in your script; see L<encoding>.
1768d7eb 57
21bad921
GS
58=back
59
60=head2 Byte and Character semantics
393fec97
GS
61
62Beginning with version 5.6, Perl uses logically wide characters to
63represent strings internally. This internal representation of strings
b3419ed8 64uses either the UTF-8 or the UTF-EBCDIC encoding.
393fec97 65
75daf61c
JH
66In future, Perl-level operations can be expected to work with
67characters rather than bytes, in general.
393fec97 68
75daf61c
JH
69However, as strictly an interim compatibility measure, Perl aims to
70provide a safe migration path from byte semantics to character
71semantics for programs. For operations where Perl can unambiguously
72decide that the input data is characters, Perl now switches to
73character semantics. For operations where this determination cannot
74be made without additional information from the user, Perl decides in
75favor of compatibility, and chooses to use byte semantics.
8cbd9a7a
GS
76
77This behavior preserves compatibility with earlier versions of Perl,
78which allowed byte semantics in Perl operations, but only as long as
79none of the program's inputs are marked as being as source of Unicode
80character data. Such data may come from filehandles, from calls to
81external programs, from information provided by the system (such as %ENV),
21bad921 82or from literals and constants in the source text.
8cbd9a7a 83
75daf61c
JH
84If the C<-C> command line switch is used, (or the
85${^WIDE_SYSTEM_CALLS} global flag is set to C<1>), all system calls
86will use the corresponding wide character APIs. Note that this is
87currently only implemented on Windows since other platforms API
88standard on this area.
8cbd9a7a 89
75daf61c
JH
90Regardless of the above, the C<bytes> pragma can always be used to
91force byte semantics in a particular lexical scope. See L<bytes>.
8cbd9a7a
GS
92
93The C<utf8> pragma is primarily a compatibility device that enables
75daf61c 94recognition of UTF-(8|EBCDIC) in literals encountered by the parser.
7dedd01f
JH
95Note that this pragma is only required until a future version of Perl
96in which character semantics will become the default. This pragma may
97then become a no-op. See L<utf8>.
8cbd9a7a
GS
98
99Unless mentioned otherwise, Perl operators will use character semantics
100when they are dealing with Unicode data, and byte semantics otherwise.
101Thus, character semantics for these operations apply transparently; if
102the input data came from a Unicode source (for example, by adding a
103character encoding discipline to the filehandle whence it came, or a
104literal UTF-8 string constant in the program), character semantics
105apply; otherwise, byte semantics are in effect. To force byte semantics
8058d7ab 106on Unicode data, the C<bytes> pragma should be used.
393fec97 107
0a378802
JH
108Notice that if you concatenate strings with byte semantics and strings
109with Unicode character data, the bytes will by default be upgraded
110I<as if they were ISO 8859-1 (Latin-1)> (or if in EBCDIC, after a
111translation to ISO 8859-1). To change this, use the C<encoding>
112pragma, see L<encoding>.
7dedd01f 113
393fec97 114Under character semantics, many operations that formerly operated on
75daf61c
JH
115bytes change to operating on characters. For ASCII data this makes no
116difference, because UTF-8 stores ASCII in single bytes, but for any
117character greater than C<chr(127)>, the character B<may> be stored in
393fec97 118a sequence of two or more bytes, all of which have the high bit set.
2796c109
JH
119
120For C1 controls or Latin 1 characters on an EBCDIC platform the
121character may be stored in a UTF-EBCDIC multi byte sequence. But by
122and large, the user need not worry about this, because Perl hides it
123from the user. A character in Perl is logically just a number ranging
124from 0 to 2**32 or so. Larger characters encode to longer sequences
125of bytes internally, but again, this is just an internal detail which
126is hidden at the Perl level.
393fec97 127
8cbd9a7a 128=head2 Effects of character semantics
393fec97
GS
129
130Character semantics have the following effects:
131
132=over 4
133
134=item *
135
136Strings and patterns may contain characters that have an ordinal value
21bad921 137larger than 255.
393fec97 138
75daf61c
JH
139Presuming you use a Unicode editor to edit your program, such
140characters will typically occur directly within the literal strings as
141UTF-8 (or UTF-EBCDIC on EBCDIC platforms) characters, but you can also
142specify a particular character with an extension of the C<\x>
143notation. UTF-X characters are specified by putting the hexadecimal
144code within curlies after the C<\x>. For instance, a Unicode smiley
145face is C<\x{263A}>.
393fec97
GS
146
147=item *
148
149Identifiers within the Perl script may contain Unicode alphanumeric
150characters, including ideographs. (You are currently on your own when
75daf61c
JH
151it comes to using the canonical forms of characters--Perl doesn't
152(yet) attempt to canonicalize variable names for you.)
393fec97 153
393fec97
GS
154=item *
155
156Regular expressions match characters instead of bytes. For instance,
157"." matches a character instead of a byte. (However, the C<\C> pattern
75daf61c 158is provided to force a match a single byte ("C<char>" in C, hence C<\C>).)
393fec97 159
393fec97
GS
160=item *
161
162Character classes in regular expressions match characters instead of
163bytes, and match against the character properties specified in the
75daf61c
JH
164Unicode properties database. So C<\w> can be used to match an
165ideograph, for instance.
393fec97 166
393fec97
GS
167=item *
168
169Named Unicode properties and block ranges make be used as character
170classes via the new C<\p{}> (matches property) and C<\P{}> (doesn't
171match property) constructs. For instance, C<\p{Lu}> matches any
172character with the Unicode uppercase property, while C<\p{M}> matches
9fdf68be
JH
173any mark character. Single letter properties may omit the brackets,
174so that can be written C<\pM> also. Many predefined character classes
a1cc1cb1 175are available, such as C<\p{IsMirrored}> and C<\p{InTibetan}>.
4193bef7
JH
176
177The C<\p{Is...}> test for "general properties" such as "letter",
178"digit", while the C<\p{In...}> test for Unicode scripts and blocks.
179
e150c829
JH
180The official Unicode script and block names have spaces and dashes and
181separators, but for convenience you can have dashes, spaces, and
182underbars at every word division, and you need not care about correct
183casing. It is recommended, however, that for consistency you use the
184following naming: the official Unicode script, block, or property name
185(see below for the additional rules that apply to block names),
186with whitespace and dashes replaced with underbar, and the words
187"uppercase-first-lowercase-rest". That is, "Latin-1 Supplement"
188becomes "Latin_1_Supplement".
4193bef7 189
a1cc1cb1 190You can also negate both C<\p{}> and C<\P{}> by introducing a caret
e150c829
JH
191(^) between the first curly and the property name: C<\p{^In_Tamil}> is
192equal to C<\P{In_Tamil}>.
4193bef7 193
61247495 194The C<In> and C<Is> can be left out: C<\p{Greek}> is equal to
e150c829 195C<\p{In_Greek}>, C<\P{Pd}> is equal to C<\P{Pd}>.
393fec97 196
d73e5302
JH
197 Short Long
198
199 L Letter
e150c829
JH
200 Lu Uppercase_Letter
201 Ll Lowercase_Letter
202 Lt Titlecase_Letter
203 Lm Modifier_Letter
204 Lo Other_Letter
d73e5302
JH
205
206 M Mark
e150c829
JH
207 Mn Nonspacing_Mark
208 Mc Spacing_Mark
209 Me Enclosing_Mark
d73e5302
JH
210
211 N Number
e150c829
JH
212 Nd Decimal_Number
213 Nl Letter_Number
214 No Other_Number
d73e5302
JH
215
216 P Punctuation
e150c829
JH
217 Pc Connector_Punctuation
218 Pd Dash_Punctuation
219 Ps Open_Punctuation
220 Pe Close_Punctuation
221 Pi Initial_Punctuation
d73e5302 222 (may behave like Ps or Pe depending on usage)
e150c829 223 Pf Final_Punctuation
d73e5302 224 (may behave like Ps or Pe depending on usage)
e150c829 225 Po Other_Punctuation
d73e5302
JH
226
227 S Symbol
e150c829
JH
228 Sm Math_Symbol
229 Sc Currency_Symbol
230 Sk Modifier_Symbol
231 So Other_Symbol
d73e5302
JH
232
233 Z Separator
e150c829
JH
234 Zs Space_Separator
235 Zl Line_Separator
236 Zp Paragraph_Separator
d73e5302
JH
237
238 C Other
e150c829
JH
239 Cc Control
240 Cf Format
241 Cs Surrogate
242 Co Private_Use
243 Cn Unassigned
1ac13f9a
JH
244
245There's also C<L&> which is an alias for C<Ll>, C<Lu>, and C<Lt>.
32293815 246
d73e5302
JH
247The following reserved ranges have C<In> tests:
248
e150c829
JH
249 CJK_Ideograph_Extension_A
250 CJK_Ideograph
251 Hangul_Syllable
252 Non_Private_Use_High_Surrogate
253 Private_Use_High_Surrogate
254 Low_Surrogate
255 Private_Surrogate
256 CJK_Ideograph_Extension_B
257 Plane_15_Private_Use
258 Plane_16_Private_Use
d73e5302
JH
259
260For example C<"\x{AC00}" =~ \p{HangulSyllable}> will test true.
e9ad1727
JH
261(Handling of surrogates is not implemented yet, because Perl
262uses UTF-8 and not UTF-16 internally to represent Unicode.)
d73e5302 263
32293815
JH
264Additionally, because scripts differ in their directionality
265(for example Hebrew is written right to left), all characters
266have their directionality defined:
267
d73e5302
JH
268 BidiL Left-to-Right
269 BidiLRE Left-to-Right Embedding
270 BidiLRO Left-to-Right Override
271 BidiR Right-to-Left
272 BidiAL Right-to-Left Arabic
273 BidiRLE Right-to-Left Embedding
274 BidiRLO Right-to-Left Override
275 BidiPDF Pop Directional Format
276 BidiEN European Number
277 BidiES European Number Separator
278 BidiET European Number Terminator
279 BidiAN Arabic Number
280 BidiCS Common Number Separator
281 BidiNSM Non-Spacing Mark
282 BidiBN Boundary Neutral
283 BidiB Paragraph Separator
284 BidiS Segment Separator
285 BidiWS Whitespace
286 BidiON Other Neutrals
32293815 287
2796c109
JH
288=head2 Scripts
289
75daf61c
JH
290The scripts available for C<\p{In...}> and C<\P{In...}>, for example
291\p{InCyrillic>, are as follows, for example C<\p{InLatin}> or C<\P{InHan}>:
2796c109 292
1ac13f9a 293 Arabic
e9ad1727 294 Armenian
1ac13f9a 295 Bengali
e9ad1727
JH
296 Bopomofo
297 Canadian-Aboriginal
298 Cherokee
299 Cyrillic
300 Deseret
301 Devanagari
302 Ethiopic
303 Georgian
304 Gothic
305 Greek
1ac13f9a 306 Gujarati
e9ad1727
JH
307 Gurmukhi
308 Han
309 Hangul
310 Hebrew
311 Hiragana
312 Inherited
1ac13f9a 313 Kannada
e9ad1727
JH
314 Katakana
315 Khmer
1ac13f9a 316 Lao
e9ad1727
JH
317 Latin
318 Malayalam
319 Mongolian
1ac13f9a 320 Myanmar
1ac13f9a 321 Ogham
e9ad1727
JH
322 Old-Italic
323 Oriya
1ac13f9a 324 Runic
e9ad1727
JH
325 Sinhala
326 Syriac
327 Tamil
328 Telugu
329 Thaana
330 Thai
331 Tibetan
1ac13f9a 332 Yi
1ac13f9a
JH
333
334There are also extended property classes that supplement the basic
335properties, defined by the F<PropList> Unicode database:
336
e9ad1727 337 ASCII_Hex_Digit
1ac13f9a 338 Bidi_Control
1ac13f9a 339 Dash
1ac13f9a
JH
340 Diacritic
341 Extender
e9ad1727
JH
342 Hex_Digit
343 Hyphen
344 Ideographic
345 Join_Control
346 Noncharacter_Code_Point
347 Other_Alphabetic
1ac13f9a 348 Other_Lowercase
e9ad1727 349 Other_Math
1ac13f9a 350 Other_Uppercase
e9ad1727 351 Quotation_Mark
e150c829 352 White_Space
1ac13f9a
JH
353
354and further derived properties:
355
356 Alphabetic Lu + Ll + Lt + Lm + Lo + Other_Alphabetic
357 Lowercase Ll + Other_Lowercase
358 Uppercase Lu + Other_Uppercase
359 Math Sm + Other_Math
360
361 ID_Start Lu + Ll + Lt + Lm + Lo + Nl
362 ID_Continue ID_Start + Mn + Mc + Nd + Pc
363
364 Any Any character
365 Assigned Any non-Cn character
366 Common Any character (or unassigned code point)
e150c829 367 not explicitly assigned to a script
2796c109
JH
368
369=head2 Blocks
370
371In addition to B<scripts>, Unicode also defines B<blocks> of
372characters. The difference between scripts and blocks is that the
e9ad1727 373scripts concept is closer to natural languages, while the blocks
2796c109
JH
374concept is more an artificial grouping based on groups of 256 Unicode
375characters. For example, the C<Latin> script contains letters from
e9ad1727
JH
376many blocks. On the other hand, the C<Latin> script does not contain
377all the characters from those blocks, it does not for example contain
378digits because digits are shared across many scripts. Digits and
379other similar groups, like punctuation, are in a category called
380C<Common>.
2796c109
JH
381
382For more about scripts see the UTR #24:
383http://www.unicode.org/unicode/reports/tr24/
384For more about blocks see
385http://www.unicode.org/Public/UNIDATA/Blocks.txt
386
387Because there are overlaps in naming (there are, for example, both
388a script called C<Katakana> and a block called C<Katakana>, the block
389version has C<Block> appended to its name, C<\p{InKatakanaBlock}>.
390
391Notice that this definition was introduced in Perl 5.8.0: in Perl
e150c829 3925.6 only the blocks were used; in Perl 5.8.0 scripts became the
61247495
JH
393preferential Unicode character class definition; this meant that
394the definitions of some character classes changed (the ones in the
2796c109
JH
395below list that have the C<Block> appended).
396
e9ad1727
JH
397 Alphabetic Presentation Forms
398 Arabic Block
399 Arabic Presentation Forms-A
400 Arabic Presentation Forms-B
401 Armenian Block
402 Arrows
71d929cb 403 Basic Latin
e9ad1727
JH
404 Bengali Block
405 Block Elements
406 Bopomofo Block
407 Bopomofo Extended
408 Box Drawing
409 Braille Patterns
410 Byzantine Musical Symbols
411 CJK Compatibility
412 CJK Compatibility Forms
413 CJK Compatibility Ideographs
414 CJK Compatibility Ideographs Supplement
415 CJK Radicals Supplement
416 CJK Symbols and Punctuation
417 CJK Unified Ideographs
418 CJK Unified Ideographs Extension A
419 CJK Unified Ideographs Extension B
420 Cherokee Block
71d929cb 421 Combining Diacritical Marks
e9ad1727
JH
422 Combining Half Marks
423 Combining Marks for Symbols
424 Control Pictures
425 Currency Symbols
71d929cb 426 Cyrillic Block
e9ad1727 427 Deseret Block
71d929cb 428 Devanagari Block
e9ad1727
JH
429 Dingbats
430 Enclosed Alphanumerics
431 Enclosed CJK Letters and Months
432 Ethiopic Block
433 General Punctuation
434 Geometric Shapes
71d929cb 435 Georgian Block
e9ad1727
JH
436 Gothic Block
437 Greek Block
438 Greek Extended
439 Gujarati Block
440 Gurmukhi Block
441 Halfwidth and Fullwidth Forms
442 Hangul Compatibility Jamo
71d929cb 443 Hangul Jamo
e9ad1727
JH
444 Hangul Syllables
445 Hebrew Block
446 High Private Use Surrogates
447 High Surrogates
448 Hiragana Block
449 IPA Extensions
450 Ideographic Description Characters
451 Kanbun
452 Kangxi Radicals
453 Kannada Block
454 Katakana Block
71d929cb 455 Khmer Block
e9ad1727
JH
456 Lao Block
457 Latin 1 Supplement
71d929cb 458 Latin Extended Additional
e9ad1727
JH
459 Latin Extended-A
460 Latin Extended-B
71d929cb 461 Letterlike Symbols
e9ad1727
JH
462 Low Surrogates
463 Malayalam Block
464 Mathematical Alphanumeric Symbols
71d929cb 465 Mathematical Operators
e9ad1727 466 Miscellaneous Symbols
71d929cb 467 Miscellaneous Technical
e9ad1727
JH
468 Mongolian Block
469 Musical Symbols
470 Myanmar Block
471 Number Forms
472 Ogham Block
473 Old Italic Block
71d929cb 474 Optical Character Recognition
e9ad1727 475 Oriya Block
71d929cb 476 Private Use
e9ad1727
JH
477 Runic Block
478 Sinhala Block
71d929cb 479 Small Form Variants
e9ad1727 480 Spacing Modifier Letters
2796c109 481 Specials
e9ad1727
JH
482 Superscripts and Subscripts
483 Syriac Block
2796c109 484 Tags
e9ad1727
JH
485 Tamil Block
486 Telugu Block
487 Thaana Block
488 Thai Block
489 Tibetan Block
490 Unified Canadian Aboriginal Syllabics
491 Yi Radicals
492 Yi Syllables
32293815 493
393fec97
GS
494=item *
495
496The special pattern C<\X> match matches any extended Unicode sequence
497(a "combining character sequence" in Standardese), where the first
498character is a base character and subsequent characters are mark
499characters that apply to the base character. It is equivalent to
500C<(?:\PM\pM*)>.
501
393fec97
GS
502=item *
503
383e7cdd
JH
504The C<tr///> operator translates characters instead of bytes. Note
505that the C<tr///CU> functionality has been removed, as the interface
506was a mistake. For similar functionality see pack('U0', ...) and
507pack('C0', ...).
393fec97 508
393fec97
GS
509=item *
510
511Case translation operators use the Unicode case translation tables
44bc797b
JH
512when provided character input. Note that C<uc()> (also known as C<\U>
513in doublequoted strings) translates to uppercase, while C<ucfirst>
514(also known as C<\u> in doublequoted strings) translates to titlecase
515(for languages that make the distinction). Naturally the
516corresponding backslash sequences have the same semantics.
393fec97
GS
517
518=item *
519
520Most operators that deal with positions or lengths in the string will
75daf61c
JH
521automatically switch to using character positions, including
522C<chop()>, C<substr()>, C<pos()>, C<index()>, C<rindex()>,
523C<sprintf()>, C<write()>, and C<length()>. Operators that
524specifically don't switch include C<vec()>, C<pack()>, and
525C<unpack()>. Operators that really don't care include C<chomp()>, as
526well as any other operator that treats a string as a bucket of bits,
527such as C<sort()>, and the operators dealing with filenames.
393fec97
GS
528
529=item *
530
531The C<pack()>/C<unpack()> letters "C<c>" and "C<C>" do I<not> change,
532since they're often used for byte-oriented formats. (Again, think
533"C<char>" in the C language.) However, there is a new "C<U>" specifier
534that will convert between UTF-8 characters and integers. (It works
535outside of the utf8 pragma too.)
536
537=item *
538
539The C<chr()> and C<ord()> functions work on characters. This is like
540C<pack("U")> and C<unpack("U")>, not like C<pack("C")> and
541C<unpack("C")>. In fact, the latter are how you now emulate
35bcd338
JH
542byte-oriented C<chr()> and C<ord()> for Unicode strings.
543(Note that this reveals the internal UTF-8 encoding of strings and
544you are not supposed to do that unless you know what you are doing.)
393fec97
GS
545
546=item *
547
a1ca4561
YST
548The bit string operators C<& | ^ ~> can operate on character data.
549However, for backward compatibility reasons (bit string operations
75daf61c
JH
550when the characters all are less than 256 in ordinal value) one should
551not mix C<~> (the bit complement) and characters both less than 256 and
a1ca4561
YST
552equal or greater than 256. Most importantly, the DeMorgan's laws
553(C<~($x|$y) eq ~$x&~$y>, C<~($x&$y) eq ~$x|~$y>) won't hold.
554Another way to look at this is that the complement cannot return
75daf61c 555B<both> the 8-bit (byte) wide bit complement B<and> the full character
a1ca4561
YST
556wide bit complement.
557
558=item *
559
983ffd37
JH
560lc(), uc(), lcfirst(), and ucfirst() work for the following cases:
561
562=over 8
563
564=item *
565
566the case mapping is from a single Unicode character to another
567single Unicode character
568
569=item *
570
571the case mapping is from a single Unicode character to more
572than one Unicode character
573
574=back
575
576What doesn't yet work are the followng cases:
577
578=over 8
579
580=item *
581
582the "final sigma" (Greek)
583
584=item *
585
586anything to with locales (Lithuanian, Turkish, Azeri)
587
588=back
589
590See the Unicode Technical Report #21, Case Mappings, for more details.
ac1256e8
JH
591
592=item *
593
393fec97
GS
594And finally, C<scalar reverse()> reverses by character rather than by byte.
595
596=back
597
8cbd9a7a
GS
598=head2 Character encodings for input and output
599
7221edc9 600See L<Encode>.
8cbd9a7a 601
393fec97
GS
602=head1 CAVEATS
603
604As of yet, there is no method for automatically coercing input and
b3419ed8
PK
605output to some encoding other than UTF-8 or UTF-EBCDIC. This is planned
606in the near future, however.
393fec97 607
8cbd9a7a
GS
608Whether an arbitrary piece of data will be treated as "characters" or
609"bytes" by internal operations cannot be divined at the current time.
393fec97
GS
610
611Use of locales with utf8 may lead to odd results. Currently there is
612some attempt to apply 8-bit locale info to characters in the range
6130..255, but this is demonstrably incorrect for locales that use
614characters above that range (when mapped into Unicode). It will also
615tend to run slower. Avoidance of locales is strongly encouraged.
616
776f8809
JH
617=head1 UNICODE REGULAR EXPRESSION SUPPORT LEVEL
618
619The following list of Unicode regular expression support describes
620feature by feature the Unicode support implemented in Perl as of Perl
6215.8.0. The "Level N" and the section numbers refer to the Unicode
622Technical Report 18, "Unicode Regular Expression Guidelines".
623
624=over 4
625
626=item *
627
628Level 1 - Basic Unicode Support
629
630 2.1 Hex Notation - done [1]
631 Named Notation - done [2]
632 2.2 Categories - done [3][4]
633 2.3 Subtraction - MISSING [5][6]
634 2.4 Simple Word Boundaries - done [7]
635 2.5 Simple Loose Matches - MISSING [8]
636 2.6 End of Line - MISSING [9][10]
637
638 [ 1] \x{...}
639 [ 2] \N{...}
640 [ 3] . \p{Is...} \P{Is...}
641 [ 4] now scripts (see UTR#24 Script Names) in addition to blocks
642 [ 5] have negation
643 [ 6] can use look-ahead to emulate subtracion
644 [ 7] include Letters in word characters
645 [ 8] see UTR#21 Case Mappings
646 [ 9] see UTR#13 Unicode Newline Guidelines
647 [10] should do ^ and $ also on \x{2028} and \x{2029}
648
649=item *
650
651Level 2 - Extended Unicode Support
652
653 3.1 Surrogates - MISSING
654 3.2 Canonical Equivalents - MISSING [11][12]
655 3.3 Locale-Independent Graphemes - MISSING [13]
656 3.4 Locale-Independent Words - MISSING [14]
657 3.5 Locale-Independent Loose Matches - MISSING [15]
658
659 [11] see UTR#15 Unicode Normalization
660 [12] have Unicode::Normalize but not integrated to regexes
661 [13] have \X but at this level . should equal that
662 [14] need three classes, not just \w and \W
663 [15] see UTR#21 Case Mappings
664
665=item *
666
667Level 3 - Locale-Sensitive Support
668
669 4.1 Locale-Dependent Categories - MISSING
670 4.2 Locale-Dependent Graphemes - MISSING [16][17]
671 4.3 Locale-Dependent Words - MISSING
672 4.4 Locale-Dependent Loose Matches - MISSING
673 4.5 Locale-Dependent Ranges - MISSING
674
675 [16] see UTR#10 Unicode Collation Algorithms
676 [17] have Unicode::Collate but not integrated to regexes
677
678=back
679
393fec97
GS
680=head1 SEE ALSO
681
32293815 682L<bytes>, L<utf8>, L<perlretut>, L<perlvar/"${^WIDE_SYSTEM_CALLS}">
393fec97
GS
683
684=cut