perl use utf8
utf8 Perl编译 来启用/禁用 UTF-8(or UTF-EBCDIC) 在源代码里 简洁: use utf8;
no utf8; # Convert the internal representation of a Perl scalar to/from UTF-8. $num_octets = utf8::upgrade($string);
$success = utf8::downgrade($string[, $fail_ok]); # Change each character of a Perl scalar to/from a series of
# characters that represent the UTF-8 bytes of each original character. utf8::encode($string); # "\x{100}" becomes "\xc4\x80"
utf8::decode($string); # "\xc4\x80" becomes "\x{100}" # Convert a code point from the platform native character set to
# Unicode, and vice-versa.
$unicode = utf8::native_to_unicode(ord('A')); # returns 65 on both
# ASCII and EBCDIC
# platforms
$native = utf8::unicode_to_native(65); # returns 65 on ASCII
# platforms; 193 on
# EBCDIC $flag = utf8::is_utf8($string); # since Perl 5.8.1
$flag = utf8::valid($string) 描述: 使用utf8 编译告诉perl解析器 允许UTF-8在程序文本在当前的词法范围。 no utf8 编译告诉Perl 切回到对待文本作为literal 字节在当前的词法范围。 (在EBCDIC 平台,技术是允许UTF-EBCDIC, 不是UTF-8. 但是这个区别是学术的,因此在这个文件术语UTF-8是用于两者) 不要使用这个编译除了告诉Perl你的脚本是用UTF-8写的。 下面的描述是直接使用没有use utf8: 因为它不可能可靠的告诉UTF-8 从本地的8位编码, 你需要一个字节顺序标记在你的源代码的开始,或者use utf8,来指导perl 当UTF-8 变为标准的源代码格式,这个指令会有效的 变成一个 no-op 也可以查询-C切换的影响和它的cousin, PERL_UNICODE 环境变量 启动utf8程序有下面的影响: 在源文本中的字节不是以 ASCII character set 会被对待一个 literal UTF-8 sequence的一部分。 这包括很多的literals 比如标识符名称,字符串常量,和恒定的正则表达式模式。 注意如果你有non-ASCII, non-UTF-8 字节在你的脚本 use utf8会不高兴。因为你需要有这样的字节在use utf8, 你可以禁用这个程序直到最后的块(或者文件,如果在顶层) 通过使用no utf8 有用的函数; 下面的函数是定义在e utf8:: package,你不需要say use utf8 来使用那些 实际上 你不应该say 除非你真的需要UTF-8源代码
perl use utf8的更多相关文章
- perl unload utf-8 oracle 数据库
perl unload utf-8 Oracle [oracle@oadb sbin]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Produc ...
- 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 = ' ...
- perl unicode utf-8 \x转换
[root@dr-mysql01 ~]# cat x5.pl use Encode; use JSON; use URI::Escape; use LWP::Simple; my $host = &q ...
- perl oracle utf-8 结果匹配中文字符
[oracle@oadb sbin]$ cat s1.pl #!/usr/bin/perl use DBI; use Encode; use HTTP::Date qw(time2iso str2ti ...
- Perl中文/unicode/utf8/GB2312之间的转换
参考:http://daimajishu.iteye.com/blog/959239不过具测试,也有错误:原文如下: # author: jiangyujieuse utf8; ##在最后一个例子, ...
- perl 学习笔记
一:基础 1:安装perl centos: yum -y install perl 官网:https://www.perl.org/ 升级到5.22:先下载,执行./i ...
- 【转】Perl Unicode全攻略
Perl Unicode全攻略 耐心看完本文,相信你今后在unicode处理上不会再有什么问题. 本文内容适用于perl 5.8及其以上版本. perl internal form 在Perl看来, ...
- Perl Unicode全攻略
Perl Unicode全攻略 耐心看完本文,相信你今后在unicode处理上不会再有什么问题. 本文内容适用于perl 5.8及其以上版本. perl internal form 在Perl看来, ...
- perl字符集处理
本文内容适用于perl 5.8及其以上版本. perl internal form 在 Perl看来, 字符串只有两种形式. 一种是octets, 即8位序列, 也就是我们通常说的字节数组. 另一种u ...
随机推荐
- Qt 技巧:设置在 debug 路径下直接运行可执行文件
Qt 编译的时候默认会使用影子构建,这时在工作路径下会生成一个目录:xxx-build-desktop-xxx. 如果编译通过,在该目录下会生成一个可执行文件,双击之,但不能运行,提示是缺少某个动态库 ...
- spring 事务 笔记3.1
Spring事务 以前的事务都是编程式事务,需要开启和关闭,然后程序写在这里面 spring,声明式事务 Spring事务隔离级别 DEFAULT 使用数据库默认隔离级别 READ_UNCOMMITT ...
- 字符串操作函数<string.h>相关函数strcpy,strcat,等源码。
首先说一下源码到底在哪里找. 我们在文件中包含<cstring>时,如果点击右键打开文档, 会打开cstring,我们会发现路径为: D:\Program Files\visual stu ...
- perl 处理json 数组格式
[root@dr-mysql01 ~]# cat a1.pl use Encode; use JSON; use URI::Escape; use LWP::Simple; my $host = &q ...
- PDO--PHP Data Objects
PDO的环境配置:开启支持PDO 在php.ini配置文件里开启: extension=php_pdo.dll extension=php_pdo_mysql.dll 在PDO操作中涉及到类:PDO. ...
- tomcat 系统服务 outofmemory
TOMCAT内存溢出outofmemory的问题: http://hi.baidu.com/mefeng47/item/3b247af74ce4e24e922af2e5 注:双击tomcat6w.ex ...
- ORA-00923: 未找到要求的 FROM 关键字
oracle处理 后台数据时, select a.oga01 发货单号,e.imaud04 箱/套from oga_file a left join ogb_file b on b.ogb01 = a ...
- ThinkPHP - 模板使用函数
模板使用函数 1.模板引擎自带函数:仅仅是输出变量并不能满足模板输出的需要,内置模板引擎支持对模板变量使用调节器和格式化功能,其实也就是提供函数支持,并支持多个函数同时使用.用于模板标签的函数可以是P ...
- 观django-messages包笔记
django_messages是一个提供注册用户之间互相发送消息的django app.最近在研究其实现机制,安装测试非常容易,导入包,配好url以及syncdb生成数据库即可使用. 一.收获一: 我 ...
- android 根据域名得到IP
public static String GetInetAddress(String host) { String IPAddress = ""; InetAddress Retu ...