jrhapt01:/home/tomcat/test> cat a2.pl
my $str="$ARGV[0]";
use Encode;
use URI::Escape;
use LWP::Simple;
$str =~ s/\\u([0-9a-fA-F]{4})/pack("U",,hex($1))/eg;
print $str;
print "\n";
jrhapt01:/home/tomcat/test> perl a2.pl "\u767b\u5f55\u6210\u529f"
Wide character in print at a2.pl line 6.
登录成功 jrhapt01:/home/tomcat/test> cat a2.pl
my $str="$ARGV[0]";
use Encode;
use URI::Escape;
use LWP::Simple;
$str =~ s/\\u([0-9a-fA-F]{4})/pack("U",,hex($1))/eg;
print encode_utf8($str);
print "\n";
jrhapt01:/home/tomcat/test> perl a2.pl "\u767b\u5f55\u6210\u529f"
登录成功 encode_utf8 作用:
jrhapt01:/home/tomcat/test> cat a3.pl
my $str="中均";
print "\$str is $str\n"; use Encode;
print "111111111111111111\n";
my $var= encode_utf8($str);
print "\$var is $var\n";
print decode_utf8($var);
print "\n"; jrhapt01:/home/tomcat/test> perl a3.pl
$str is 中均
111111111111111111
$var is 中均
中均 $octets = encode_utf8($string);
Equivalent to "$octets = encode("utf8", $string);" The characters that comprise $string are encoded in Perl’s internal format and the result is returned as a sequence of octets. All
possible characters have a UTF-8 representation so this function cannot fail. 等价于 "$octets = encode("utf8", $string);" 字符串构成$string 是编码成perl的内部格式,结果是 一个有序的8位字节 所有可能的字符串有一个UTF-8 表示 $string = decode_utf8($octets [, CHECK]);
equivalent to "$string = decode("utf8", $octets [, CHECK])". The sequence of octets represented by $octets is decoded from UTF-8 into a sequence of logical characters. Not all
sequences of octets form valid UTF-8 encodings, so it is possible for this call to fail. For CHECK, see "Handling Malformed Data". 等价于 "$string = decode("utf8", $octets [, CHECK])". 8位字节的顺序是被解码从UTF-8 到一个逻辑字符的顺序

Wide character in print at a2.pl line 6.的更多相关文章

  1. Wide character in print at a2.pl line 返回json 需要encode_utf8

    centos6.5:/root/test#cat a2.pl use Net::SMTP; use LWP::UserAgent; use HTTP::Cookies; use HTTP::Heade ...

  2. perl unload utf-8 oracle Wide character in print at unload_oracle.pl line 105.

    #!/usr/bin/perl use DBI; use Encode; my $dbName = 'oadb'; my $dbUser = 'vxspace'; my $dbUserPass = ' ...

  3. Wide character in print at hcp.pl line 21.

    jrhmpt01:/root# cat -n hcp.pl 1 use LWP::UserAgent; 2 use Encode; 3 $ua = LWP::UserAgent->new; 4 ...

  4. 为什么出现Wide character in print at a14.pl line 41

    [root@wx03 ~]# cat a14.pl use Net::SMTP; use LWP::UserAgent; use HTTP::Cookies; use HTTP::Headers; u ...

  5. php 返回json 解析 报Wide character in print

    php 返回json: zabbix:/var/www/html/DEVOPS/Home/Lib/Action# vim EquipmentAction.class.php <?php head ...

  6. Can't locate find.pl in @INC (@INC contains: /etc/perl xxxx) at perlpath.pl line 7.

    /********************************************************************** * Can't locate find.pl in @I ...

  7. error: converting to execution character set: Invalid or incomplete multibyte or wide character

    交叉编译.c文件,遇到如下问题 arm-linux-gcc -o show_lines show_lines.c -lfreetype -lm show_lines.c:199:19: error: ...

  8. SyntaxError: Non-ASCII character 'æ' in file csdn.py on line 7, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

    错误信息: SyntaxError: Non-ASCII character , but no encoding declared; see http://python.org/dev/peps/pe ...

  9. 编译内核错误:Can't use 'defined(@array)' (Maybe you should just omit the defined()?) at kernel/timeconst.pl line 373

    最近在编译一个新的rk sdk的时候,编译内核报错 CHK include/linux/version.h CHK include/generated/utsrelease.h make[1]: 'i ...

随机推荐

  1. Unity3D 之UGUI 按钮

    新建一个按钮 按钮对应的属性 按钮下面只有一个文本的 游戏对象,是Button对应的显示文字 Interactable -->是否可以交互 Transition -->变换,对应各种关于按 ...

  2. com.android.builder.packaging.DuplicateFile

    解决方法:     packagingOptions {        exclude 'META-INF/DEPENDENCIES'        exclude 'META-INF/NOTICE' ...

  3. [linux] 系统管理常用命令

    1.查看某个软件是否安装: rpm -qa|grep software_name 2.top命令,显示系统的动态视图,q退出 3.ps aux|grep process_name 显示正在运行的进程 ...

  4. Mysql笔记【1】-数据库的基本操作(创建/删除)

    1.创建数据库 创建数据库(如果存在,则报错) #创建名称为test的数据库 create database test 查询创建完的数据库 show databases 2.删除数据库 删除数据库(如 ...

  5. java之内存管理

    对于JVM的垃圾回收机制来说,是否回收一个对象的标准在于:是否还有引用变量引用该对象,只要有引用变量引用该对象,垃圾回收机制就不会回收它. 强引用:创建一个对象,并把这个对象赋给一个引用变量.这种引用 ...

  6. Codeforces Round #299 (Div. 1)

    Problem A: 实际上对于一段数字假设和为k,每次取较大的m个进行t次减一操作,最多减去的是min(m*t,k). 明白了这个结论就可以直接二分答案了. #include <bits/st ...

  7. ASP.Net大文件上传组件详解

    首先右键单击网站根目录,在弹出的快捷菜单中,选择"添加引用"菜单项,弹出"添加引用",切换到"浏览"找到组件的Dll文件"Best ...

  8. linux - Mysql 创建用户和授权

    CREATE USER 'cui'@'%' IDENTIFIED BY 'xxxxxxxxxxxxxxxxxx'; GRANT ALL ON test_db.* TO 'cui'@'%'; REVOK ...

  9. MySQL的多实例

    一.准备工作     1.关闭mysql进程     # pkill     # service mysqld stop         2.从系统服务中删除mysqld     # chkconfi ...

  10. bm25

    BM25算法,通常用来作搜索相关性平分.一句话概况其主要思想:对Query进行语素解析,生成语素qi:然后,对于每个搜索结果D,计算每个语素qi与D的相关性得分,最后,将qi相对于D的相关性得分进行加 ...