-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
p4raw-id: //depot/perl@15980
- Loading branch information
Showing
4 changed files
with
277 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,9 @@ specially designed to be readable as is. | |
|
||
The following documentation is written in EUC-CN encoding. | ||
|
||
?�?����һ������ֱ༭����������ĵ�, ������������ص�ע���ַ�. ����� | ||
������ POD (�����ĵ���ʽ) д��; ���ָ�ʽ��Ϊ����?���ֱ�Ӷ�ȡ���ر���? | ||
��. ���ڴ˸�ʽ�Ľ�һ����Ѷ, ��ο� perlpod �����ĵ�. | ||
�������һ������ֱ༭����������ļ�, ������������ص�ע���ַ�. | ||
����ļ����� POD (�����ļ���ʽ) д��; ���ָ�ʽ��Ϊ��������ֱ�Ӷ�ȡ, | ||
���ر���Ƶ�. ���ڴ˸�ʽ�Ľ�һ����Ϣ, ��ο� perlpod �����ļ�. | ||
|
||
=head1 NAME | ||
|
||
|
@@ -16,16 +16,16 @@ perlcn - | |
|
||
��ӭ���� Perl �����! | ||
|
||
�� 5.8.0 �濪ʼ, Perl �߱����꾡�� Unicode (ͳһ��) ֧Ԯ, Ҳ����֧Ԯ�� | ||
����������ϵ����ı��뷽ʽ; CJK (��?պ?) �������е�һ����. Unicode �� | ||
�����Եı�, ��ͼ�������������е��ַ�: ��������, ��������, �Լ����� | ||
��һ�� (ϣ����, ��������, ��������, ϣ������, ӡ����, ӡ�ذ���, �ȵ�). | ||
��Ҳ?����˶�����ҵϵͳ��ƽ�? (?? PC �������). | ||
�� 5.8.0 �濪ʼ, Perl �߱������Ƶ� Unicode (ͳһ��) ֧Ԯ, | ||
Ҳ����֧Ԯ������������ϵ����ı��뷽ʽ; CJK (���պ�) �������е�һ����. | ||
Unicode �ǹ����Եı�, ��ͼ�������������е��ַ�: ��������, ��������, | ||
�Լ������һ�� (ϣ����, ��������, ��������, ϣ������, ӡ����, | ||
ӡ�ذ���, �ȵ�). ��Ҳ�����˶�����ҵϵͳ��ƽ̨ (�� PC �������). | ||
|
||
Perl ������ Unicode ���в���. ���ʾ Perl �ڲ����ִ����Ͽ��� Unicode | ||
��ʾ, Perl �ĺ�ʽ����� (��?��?���ʾʽ�ȶ�) Ҳ�ܶ� Unicode ���в���. | ||
����?뼰����?, Ϊ�˴����� Unicode ֮ǰ�ı��뷽ʽ���������, Perl �ṩ | ||
�ˡ�Encode�����ģ��, ����?������ض�ȡ��д����еı������?. | ||
Perl ������ Unicode ���в���. ���ʾ Perl �ڲ����ַ������ݿ��� Unicode | ||
��ʾ; Perl �ĺ�ʽ����� (���������ʾʽ�ȶ�) Ҳ�ܶ� Unicode ���в���. | ||
�����뼰���ʱ, Ϊ�˴����� Unicode ֮ǰ�ı��뷽ʽ���������, Perl | ||
�ṩ�� Encode ���ģ��, �����������ض�ȡ��д����еı�������. | ||
|
||
Encode ����ģ��֧Ԯ���м������ĵı��뷽ʽ: | ||
|
||
|
@@ -36,46 +36,51 @@ Encode | |
cp936 ����ҳ 936, Ҳ��Ϊ GBK (���������) | ||
hz 7 �����ݳ�ʽ GB2312 ���� | ||
|
||
������˵, �� euc-cn ����ĵ���ת�� Unicode, �����?�����ָ�?: | ||
������˵, �� EUC-CN ����ĵ���ת�� Unicode, �����������ָ��: | ||
|
||
perl -Mencoding=euc-cn,STDOUT,utf8 -pe1 < file.euc-cn > file.utf8 | ||
|
||
Perl Ҳ�ڸ��ˡ�piconv��, һ֧��?��? Perl д�ɵ��ַ�ת�����߳���, �÷� | ||
?��?: | ||
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�����, ?������?: | ||
����, ���� encoding ģ��, ���������д�����ַ�Ϊ��λ�ij�����, ������ʾ: | ||
|
||
#!/usr/bin/env perl | ||
# ���� euc-cn �ִ�����; �����?뼰���������? euc-cn ���� | ||
use encoding 'euc-cn', STDIN => 'euc-cn', | ||
STDOUT => 'euc-cn', STDERR => 'euc-cn'; | ||
|
||
# ���� euc-cn �ִ�����; ������뼰��������Ϊ euc-cn ���� | ||
use encoding 'euc-cn', STDIN => 'euc-cn', STDOUT => 'euc-cn'; | ||
print length("����"); # 2 (˫���ű�ʾ�ַ�) | ||
print length('����'); # 4 (�����ű�ʾ�ֽ�) | ||
print index("�̻�", "��"); # -1 (�����������ִ�) | ||
print length('����'); # 4 (�����ű�ʾλԪ��) | ||
print index("�̻�", "��"); # -1 (�����������ַ���) | ||
print index('�̻�', '��'); # 1 (�ӵڶ����ֽڿ�ʼ) | ||
|
||
�����һ��������, "" �ĵڶ���λԪ���� "" �ĵ�һ��λԪ���ϳ� EUC-CN | ||
��� "��"; "" �ĵڶ���λԪ������ "��" �ĵ�һ��λԪ���ϳ� "��". | ||
��������ǰ EUC-CN ��ȶԴ����ϳ���������. | ||
|
||
=head2 ��������ı��� | ||
|
||
?�?��Ҫ��������ı���, ���Դ� CPAN (L<http://www.cpan.org/>) ���� | ||
�����Ҫ��������ı���, ���Դ� CPAN (L<http://www.cpan.org/>) ���� | ||
Encode::HanExtra ģ��. ��Ŀǰ�ṩ���б��뷽ʽ: | ||
|
||
gb18030 �����������, ������������ | ||
|
||
����, Encode::HanConvert ģ�����ṩ�˼�ת���õ����ֱ���: | ||
|
||
gbk-trad GBK ���������� Unicode �������Ļ�ת | ||
big5-simp Big5 ���������� Unicode �������Ļ�ת | ||
gbk-trad GBK ���������� Unicode �������Ļ�ת | ||
|
||
?����? GBK �� Big5 ֮�以ת, ��ο���ģ���ڸ��� b2g.pl �� g2b.pl �� | ||
֧����. | ||
������ GBK �� Big5 ֮�以ת, ��ο���ģ���ڸ��� b2g.pl �� g2b.pl ��֧����, | ||
���ڳ�����ʹ������д��: | ||
|
||
=head2 ��һ������Ѷ | ||
use Encode::HanConvert; | ||
$euc_cn = big5_to_gb($big5); # �� Big5 תΪ GBK | ||
$big5 = gb_to_big5($euc_cn); # �� GBK תΪ Big5 | ||
|
||
��ο� Perl �ڸ��Ĵ���˵���ĵ� (����?������?��д��) , ��ѧϰ������� | ||
=head2 ��һ������Ϣ | ||
|
||
��ο� Perl �ڸ��Ĵ���˵���ļ� (����ȫ����Ӣ��д��), ��ѧϰ������� | ||
Perl ��֪ʶ, �Լ� Unicode ��ʹ�÷�ʽ. ����, �ⲿ����Դ�൱�ḻ: | ||
|
||
=head2 �ṩ Perl ��Դ����ַ | ||
|
@@ -130,6 +135,10 @@ Unix/Linux | |
|
||
=back | ||
|
||
=head1 SEE ALSO | ||
|
||
L<Encode>, L<Encode::CN>, L<encoding>, L<perluniintro>, L<perlunicode> | ||
|
||
=head1 AUTHORS | ||
|
||
Jarkko Hietaniemi E<lt>[email protected]<gt> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.