- 论坛徽章:
- 0
|
本帖最后由 beyondlee1 于 2016-11-16 14:14 编辑
- #!/usr/bin/perl
- use strict;
- use warnings;
- use utf8;
- binmode (STDOUT, ':encoding(utf8)');
- sub get_values{
- my $val = shift;
- ($_, $val) = $val =~ m!油墨型号([^a-z]*)((?:\s*[-/a-z0-9]+|\s*[((]指定[))])+)!i;
- $val .= $1 if (/([((]指定[))])/);
- return "$val\n";
- }
- while (<DATA>){
- print get_values ($_);
- }
- __DATA__
- 双面阻焊,油墨型号:ZM-400 WF(指定);颜色:绿色;油墨特性:感光;油墨厚度:厂内管控20+/-5um;导电孔方式:塞孔;无卤素板材,阻焊不可退洗,如要退洗,请提出申请
- 单面阻焊:S/S面;油墨型号:PSR-2000 LF03HF(指定);颜色:绿色;油墨特性:感光;油墨厚度:10-25um;无卤素板材不可以退洗,如要退洗请提出申请
复制代码 我的脚本添加这两句出错:- use utf8;
- binmode (STDOUT, ':encoding(utf8)');
复制代码 为何?
错误如下:
- Malformed UTF-8 character (unexpected non-continuation byte 0xcd, immediately after start byte 0xd3) at get_mask1.pl line 10.
- Malformed UTF-8 character (unexpected non-continuation byte 0xc4, immediately after start byte 0xcd) at get_mask1.pl line 10.
- Malformed UTF-8 character (unexpected non-continuation byte 0xcd, immediately after start byte 0xd0) at get_mask1.pl line 10.
- Malformed UTF-8 character (unexpected non-continuation byte 0x28, immediately after start byte 0xc5) at get_mask1.pl line 10.
- Malformed UTF-8 character (unexpected continuation byte 0xa3, with no preceding start byte) at get_mask1.pl line 10.
- Malformed UTF-8 character (unexpected continuation byte 0xa8, with no preceding start byte) at get_mask1.pl line 10.
- Malformed UTF-8 character (unexpected continuation byte 0xb6, with no preceding start byte) at get_mask1.pl line 10.
- Malformed UTF-8 character (unexpected continuation byte 0xa8, with no preceding start byte) at get_mask1.pl line 10.
- Malformed UTF-8 character (unexpected continuation byte 0xa3, with no preceding start byte) at get_mask1.pl line 10.
- Malformed UTF-8 character (unexpected continuation byte 0xa9, with no preceding start byte) at get_mask1.pl line 10.
- Malformed UTF-8 character (unexpected continuation byte 0xa3, with no preceding start byte) at get_mask1.pl line 11.
- Malformed UTF-8 character (unexpected continuation byte 0xa8, with no preceding start byte) at get_mask1.pl line 11.
- Malformed UTF-8 character (unexpected continuation byte 0xb6, with no preceding start byte) at get_mask1.pl line 11.
- Malformed UTF-8 character (unexpected continuation byte 0xa8, with no preceding start byte) at get_mask1.pl line 11.
- Malformed UTF-8 character (unexpected continuation byte 0xa3, with no preceding start byte) at get_mask1.pl line 11.
- Malformed UTF-8 character (unexpected continuation byte 0xa9, with no preceding start byte) at get_mask1.pl line 11.
- utf8 "\xC3" does not map to Unicode at get_mask1.pl line 15, <DATA> line 1.
- Operation "pattern match (m//)" returns its argument for non-Unicode code point 0x189A87 at get_mask1.pl line 10, <DATA> line 1.
- Use of uninitialized value $_ in pattern match (m//) at get_mask1.pl line 11, <DATA> line 1.
- Use of uninitialized value $val in concatenation (.) or string at get_mask1.pl line 12, <DATA> line 1.
- utf8 "\xB5" does not map to Unicode at get_mask1.pl line 16, <DATA> line 2.
- Operation "pattern match (m//)" returns its argument for non-Unicode code point 0x189A87 at get_mask1.pl line 10, <DATA> line 2.
- Use of uninitialized value $_ in pattern match (m//) at get_mask1.pl line 11, <DATA> line 2.
- Use of uninitialized value $val in concatenation (.) or string at get_mask1.pl line 12, <DATA> line 2.
复制代码
|
|