X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlunicode.pod;h=230c105e1b85345e6856ea9e8d8737df5d56943f;hb=e969ef56d2ce92c4add247c1cf714c73bc057bc5;hp=410204a51e9bdbf6a1fb1a794b0bb7663682c7ca;hpb=7c17141f053276e812daf89a4cc9414f8a1fc903;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlunicode.pod b/pod/perlunicode.pod index 410204a..230c105 100644 --- a/pod/perlunicode.pod +++ b/pod/perlunicode.pod @@ -780,13 +780,13 @@ Level 1 - Basic Unicode Support capital letters with certain modifiers: the Full case-folding decomposes the letter, while the Simple case-folding would map it to a single character. - [ 9] see UTR#13 Unicode Newline Guidelines + [ 9] see UTR #13 Unicode Newline Guidelines [10] should do ^ and $ also on \x{85}, \x{2028} and \x{2029} (should also affect <>, $., and script line numbers) (the \x{85}, \x{2028} and \x{2029} do match \s) [a] You can mimic class subtraction using lookahead. -For example, what TR18 might write as +For example, what UTR #18 might write as [{Greek}-[{UNASSIGNED}]] @@ -801,6 +801,9 @@ But in this particular example, you probably really want which will match assigned characters known to be part of the Greek script. +Also see the Unicode::Regex::Set module, it does implement the full +UTR #18 grouping, intersection, union, and removal (subtraction) syntax. + [b] See L. =item * @@ -1056,6 +1059,66 @@ straddling of the proverbial fence causes problems. =back +=head2 When Unicode Does Not Happen + +While Perl does have extensive ways to input and output in Unicode, +and few other 'entry points' like the @ARGV which can be interpreted +as Unicode (UTF-8), there still are many places where Unicode (in some +encoding or another) could be given as arguments or received as +results, or both, but it is not. + +The following are such interfaces. For all of these Perl currently +(as of 5.8.1) simply assumes byte strings both as arguments and results. + +One reason why Perl does not attempt to resolve the role of Unicode in +this cases is that the answers are highly dependent on the operating +system and the file system(s). For example, whether filenames can be +in Unicode, and in exactly what kind of encoding, is not exactly a +portable concept. Similarly for the qx and system: how well will the +'command line interface' (and which of them?) handle Unicode? + +=over 4 + +=item * + +chmod, chmod, chown, chroot, exec, link, mkdir +rename, rmdir stat, symlink, truncate, unlink, utime + +=item * + +%ENV + +=item * + +glob (aka the <*>) + +=item * + +open, opendir, sysopen + +=item * + +qx (aka the backtick operator), system + +=item * + +readdir, readlink + +=back + +=head2 Forcing Unicode in Perl (Or Unforcing Unicode in Perl) + +Sometimes (see L) there are +situations where you simply need to force Perl to believe that a byte +string is UTF-8, or vice versa. The low-level calls +utf8::upgrade($bytestring) and utf8::downgrade($utf8string) are +the answers. + +Do not use them without careful thought, though: Perl may easily get +very confused, angry, or even crash, if you suddenly change the 'nature' +of scalar like that. Especially careful you have to be if you use the +utf8::upgrade(): any random byte string is not valid UTF-8. + =head2 Using Unicode in XS If you want to handle Perl Unicode in XS extensions, you may find the