小编Hel*_*man的帖子

Unicode/UTF-8文本文件:Windows控制台上的乱码(试图显示希伯来语)

我有一个宽字符文件(希伯来文本)在记事本中看起来很好(以"UTF-8编码"保存),在Notepad ++中读得很好,当我复制并粘贴到MS Word时它看起来也很好.但是当我打开一个"DOS框"(Windows控制台)并转到:"输入file.txt"时,它会打印出乱码.
是的,我在Windows控制台上完成了对Unicode的所有建议:我使用"cmd/u"打开控制台,我将字体更改为Lucida,然后输入:"chcp 65001".

运行Windows 7的PC和运行Windows XP SP3的另一台PC上的问题完全相同.

windows unicode utf-8 hebrew windows-7

10
推荐指数
1
解决办法
2万
查看次数

Perl:将Unicode字符串打印到Windows控制台

我在将Unicode字符串打印到Windows控制台*时遇到一个奇怪的问题.

考虑这个文字:

??? ???? ?????

Intermediary

??? ???? ?????
???, ??
Bye
Hello, world!
test
Run Code Online (Sandbox Code Playgroud)

假设它位于名为"file.txt"的文件中.

当我去*:"输入file.txt"时,它会打印出来.但是当它从Perl程序打印时,如下所示:

 use strict;
 use warnings;
 use Encode;
 use 5.014;
 use utf8;
 use autodie;
 use warnings    qw< FATAL  utf8     >;
 use open        qw< :std  :utf8     >;
 use feature     qw< unicode_strings >;
 use warnings 'all';

 binmode STDOUT, ':utf8';   # output should be in UTF-8
 my $word;
 my @array = ( '??? ???? ?????', 'Intermediary',
    '??? ???? ?????', '???, ??', 'Bye','Hello, world!', 'test');
 foreach $word(@array) {
    say …
Run Code Online (Sandbox Code Playgroud)

unicode console perl utf-8 unicode-string

8
推荐指数
1
解决办法
4127
查看次数

Notepad ++:阻止评论不起作用

我在Windows 7上运行Notepad ++ 5.8.5,编辑Perl程序.我想评论一段文本行(后来,或许,取消注释).
以下都不起作用: CTRL+ K,CTRL+ Q,CTRL+ shift+ K,CTRL+ shift+ Q,
选择行块并转到菜单:edit-> Comment/Uncomment - > Block Comment


以上都没有任何影响.
该怎么办?

editor notepad++

8
推荐指数
2
解决办法
3万
查看次数

为什么我的Perl程序使用Tie :: File和Unicode/UTF-8编码失败?

我正在开发一个处理外语数据的项目.我的Perl脚本运行正常.

然后我想使用Tie :: File,因为这是一个简洁的概念(并节省时间和编码).

看起来Tie:File在Unicode/UTF-8下失败了(除非我遗漏了什么).

这是一个描述问题的程序:(数据是英语,希腊语和希伯来语的混合):

use strict;
 use warnings;
 use 5.014; 
 use Win32::Console;
 use autodie; 
 use warnings qw< FATAL utf8 >;
 use Carp;
 use Carp::Always;
 use utf8;
 use feature        qw< unicode_strings>;
 use charnames      qw< :full>;
use Tie::File;

my ($i);
my ( $FileName);
my (@Tied);
binmode STDOUT, ':unix:utf8';
binmode STDERR, ':unix:utf8';
binmode $DB::OUT, ':unix:utf8' if $DB::OUT; # for the debugger
Win32::Console::OutputCP(65001);         # Set the console code page to UTF8

$FileName = 'E:\\My Documents\\Technical\\Perl\\Eclipse workspace\\Work\\'.
        'Tie File test res.txt';
tie @Tied, …
Run Code Online (Sandbox Code Playgroud)

unicode perl utf-8 tie

7
推荐指数
1
解决办法
1435
查看次数

Perl + Unicode:"宽字符串"错误

我在Windows 7上运行Active Perl 5.14.我正在尝试编写一个程序,它将读入转换表,然后处理文件并用其他模式替换某些模式 - 以上所有Unicode(UTF-8) .这是该计划的开始:

#!/usr/local/bin/perl
# Load a conversion table from CONVTABLE to %ConvTable.
# Then find matches in a file and convert them.
use strict;
use warnings;
use Encode;
use 5.014;
use utf8;
use autodie; 
use warnings    qw< FATAL  utf8     >;
use open        qw< :std  :utf8     >;
use charnames   qw< :full >;
use feature     qw< unicode_strings >;

my ($i,$j,$InputFile, $OutputFile,$word,$from,$to,$linetoprint);
my (@line, @lineout); 
my %ConvTable;    # Conversion hash
print 'Conversion table: opening file: E:\My Documents\Perl\Conversion table.txt'."\n"; …
Run Code Online (Sandbox Code Playgroud)

unicode perl utf

4
推荐指数
1
解决办法
569
查看次数

标签 统计

unicode ×4

perl ×3

utf-8 ×3

console ×1

editor ×1

hebrew ×1

notepad++ ×1

tie ×1

unicode-string ×1

utf ×1

windows ×1

windows-7 ×1