恶心的windows编码问题

一个代码,只能解析utf8格式,在win上,想替换个字符串,费劲死了
utf-8->utf-8

转成ansi格式

D:\code\test>perl -n -e "BEGIN{use utf8;use Encode;use Encode::Locale qw($ENCODING_LOCALE_FS); } my $str = encode('utf-8', decode('utf-8', $_)); $str =~s/kscdigest_id_replace/$ENV{path}/; print $str " -i.bak config-beijing-6-user18-1.ini

不做格式转换

D:\code\test>perl -n -e "BEGIN{use utf8;use Encode;use Encode::Locale qw($ENCODING_LOCALE_FS); } my $str = decode('utf-8', $_); $str =~s/region/$ENV{path}/; print $str " -i.bak config-beijing-6-user18-1.ini
Wide character in print at -e line 1, <> line 25.

猜你喜欢

转载自blog.csdn.net/juewuer/article/details/103372309