perlcn.pod revision 7c478bd95313f5f23a4c958a745db2134aa03244
If you read this file _as_is_, just ignore the funny characters you
see. It is written in the POD format (see perlpod manpage) which is
specially designed to be readable as is.
The following documentation is written in EUC-CN encoding.
�������һ������ֱ༭����������ļ�, ������������ص�ע���ַ�.
����ļ����� POD (�����ļ���ʽ) д��; ���ָ�ʽ��Ϊ��������ֱ���Ķ�,
���ر���Ƶ�. ���ڴ˸�ʽ�Ľ�һ����Ϣ, ��ο� perlpod �����ļ�.
=head1 NAME
perlcn - �������� Perl ָ��
=head1 DESCRIPTION
��ӭ���� Perl �����!
�� 5.8.0 �濪ʼ, Perl �߱������Ƶ� Unicode (ͳһ��) ֧Ԯ,
Ҳ����֧Ԯ�����������ϵ����ı��뷽ʽ; CJK (���պ�) �������е�һ����.
Unicode �ǹ���Եı�׼, ��ͼ�������������е��ַ�: ��������, ��������,
�Լ����߼��һ�� (ϣ����, ��������, ��������, ϣ������, ӡ����,
ӡ�ذ���, �ȵ�). ��Ҳ�����˶�����ҵϵͳ��ƽ̨ (�� PC �������).
Perl ������ Unicode ���в���. ���ʾ Perl �ڲ����ַ���ݿ��� Unicode
��ʾ; Perl �ĺ�ʽ����� (��������ʾʽ�ȶ�) Ҳ�ܶ� Unicode ���в���.
�����뼰���ʱ, Ϊ�˴����� Unicode ֮ǰ�ı��뷽ʽ��ŵ����, Perl
�ṩ�� Encode ���ģ��, �����������׵ض�ȡ��д����еı������.
Encode ����ģ��֧Ԯ���м������ĵı��뷽ʽ ('gb2312' ��ʾ 'euc-cn'):
euc-cn Unix �����ַ�, Ҳ�����׳ƵĹ����
gb2312-raw δ������� (�ͱ���) GB2312 �ַ��
gb12345 δ��������й��÷������ı���
iso-ir-165 GB2312 + GB6345 + GB8565 + �����ַ�
cp936 ����ҳ 936, Ҳ������ 'GBK' (��������) ָ��
hz 7 �����ݳ�ʽ GB2312 ����
������˵, �� EUC-CN ����ĵ���ת�� Unicode, �����������ָ��:
perl -Mencoding=euc-cn,STDOUT,utf8 -pe1 < file.euc-cn > file.utf8
Perl Ҳ�ڸ��� "piconv", һ֧��ȫ�� Perl д�ɵ��ַ�ת�����߳���, �÷�����:
piconv -f euc-cn -t utf8 < file.euc-cn > file.utf8
piconv -f utf8 -t euc-cn < file.utf8 > file.euc-cn
����, ���� encoding ģ��, ���������д�����ַ�Ϊ��λ�ij�����, ������ʾ:
#!/usr/bin/env perl
# ���� euc-cn �ִ�����; ��׼����뼰��׼������Ϊ euc-cn ����
use encoding 'euc-cn', STDIN => 'euc-cn', STDOUT => 'euc-cn';
print length("����"); # 2 (˫��ű�ʾ�ַ�)
print length('����'); # 4 (����ű�ʾ�ֽ�)
print index("׻׻�̻�", "�׻�"); # -1 (��������ַ�)
print index('׻׻�̻�', '�׻�'); # 1 (�ӵڶ����ֽڿ�ʼ)
�����һ��������, "׻" �ĵڶ����ֽ��� "׻" �ĵ�һ���ֽڽ�ϳ� EUC-CN
��� "��"; "׻" �ĵڶ����ֽ����� "��" �ĵ�һ���ֽڽ�ϳ� "��".
��������ǰ EUC-CN ��ȶԴ����ϳ��������.
=head2 ��������ı���
�����Ҫ�������ı���, ���Դ� CPAN (L<http://www.cpan.org/>) ����
Encode::HanExtra ģ��. ��Ŀǰ�ṩ���б��뷽ʽ:
gb18030 ���������, ��������
����, Encode::HanConvert ģ�����ṩ�˼�ת���õ����ֱ���:
big5-simp Big5 ���������� Unicode �������Ļ�ת
gbk-trad GBK ���������� Unicode �������Ļ�ת
������ GBK �� Big5 ֮�以ת, ��ο���ģ���ڸ��� b2g.pl �� g2b.pl ��֧����,
���ڳ�����ʹ������д��:
use Encode::HanConvert;
$euc_cn = big5_to_gb($big5); # �� Big5 תΪ GBK
$big5 = gb_to_big5($euc_cn); # �� GBK תΪ Big5
=head2 ��һ������Ϣ
��ο� Perl �ڸ��Ĵ���˵���ļ� (����ȫ����Ӣ��д��), ��ѧϰ������
Perl ��֪ʶ, �Լ� Unicode ��ʹ�÷�ʽ. ����, �ⲿ����Դ�൱�ḻ:
=head2 �ṩ Perl ��Դ����ַ
=over 4
=item L<http://www.perl.com/>
Perl ����ҳ (��ŷ����˾ά��)
=item L<http://www.cpan.org/>
Perl �ۺϵ���� (Comprehensive Perl Archive Network)
=item L<http://lists.perl.org/>
Perl �ʵ���̳һ��
=back
=head2 ѧϰ Perl ����ַ
=over 4
=item L<http://www.oreilly.com.cn/html/perl.html>
�������İ��ŷ���� Perl ���
=back
=head2 Perl ʹ���߼���
=over 4
=item L<http://www.pm.org/groups/asia.shtml#China>
�й� Perl �ƹ���һ��
=back
=head2 Unicode �����ַ
=over 4
=item L<http://www.unicode.org/>
Unicode ѧ��ѧ�� (Unicode ��׼���ƶ���)
=item L<http://www.cl.cam.ac.uk/%7Emgk25/unicode.html>
Unix/Linux �ϵ� UTF-8 �� Unicode �����
=back
=head1 SEE ALSO
L<Encode>, L<Encode::CN>, L<encoding>, L<perluniintro>, L<perlunicode>
=head1 AUTHORS
Jarkko Hietaniemi E<lt>jhi@iki.fiE<gt>
Autrijus Tang (���ں�) E<lt>autrijus@autrijus.orgE<gt>
=cut