内容简介:Perl中文乱码问题
binmode可以很好的解决 perl 中问题,采用 Encode1 , Encode 等方式不管用
PerlFile.pl测试源码:
#!/usr/bin/env perl
#===============================================================================
#
# FILE: perlFile.pl
#
# USAGE: ./perlFile.pl
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: YOUR NAME (),
# ORGANIZATION:
# VERSION: 1.0
# CREATED: 2017/2/8 9:49:51
# REVISION: ---
#===============================================================================
use strict;
use warnings;
use utf8;
binmode(STDIN,":encoding(gb2312)");
binmode(STDOUT,":encoding(gb2312)");
while ( <> ) {
chomp;
print $_,"\n";
last if $_ =~ m/q/xm;
}
open(FEIJI,"E:\\feiji.txt") or die "can't open the file \n";
my $car ="尾翼";
• binmode(FEIJI,":encoding(gb2312)");
# binmode( STDIN, ':encoding(gbk2312)' );
#binmode( FEIJI, ':encoding(utf8)' );
#binmode( STDOUT, ':encoding(gbk2312)' );
#binmode( STDERR, ':encoding(gbk2312)' );
#while( my $line = <FEIJI>){
#my $re = Encode::decode('GB2312','汽车');
my $count=1;
while( <FEIJI>){
#print "$_ \n" ;
# print "$_ \n" if $_ =~ /.*$re.*/;
# Encode::_utf8_on($_);
# Encode::decode_utf8($_);
#print "$_\n" ;#if $_ =~ m/$car/xm;
#print "$count: $_\n" if $_ =~ m/$car/xm;
#$count +=1;
s/汽车/风力机/g;
print;
}
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- tomcat,jboss,weblogic乱码问题以及Java中各种乱码问题大汇总
- Perl中文乱码问题
- pycharm中文乱码问题 总结
- LoadRunner 中文乱码问题解决办法
- 深入浅出理解Python“乱码”问题
- 解决jenkins 发送邮件图片乱码问题
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
嵌入式Linux应用程序开发详解
孙琼 / 人民邮电出版社 / 2006-7 / 46.00元
《嵌入式Linux应用程序开发详解》主要分为3个部分,包括Linux基础、搭建嵌入式Linux环境和嵌入式Linux的应用开发。Linux基础部分从Linux的安装过程、基本操作命令讲起,为Linux初学者能快速入门提供了保证。接着系统地讲解了嵌入式Linux的环境搭建,以及嵌入式Linux的I/O与文件系统的开发、进程控制开发、进程间通信开发、网络应用开发、基于中断的开发、设备驱动程序的开发以及......一起来看看 《嵌入式Linux应用程序开发详解》 这本书的介绍吧!