Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/perl/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl Unicode::GCString错误消息:";新:必须为Unicode字符串指定“;_Perl_Unicode - Fatal编程技术网

Perl Unicode::GCString错误消息:";新:必须为Unicode字符串指定“;

Perl Unicode::GCString错误消息:";新:必须为Unicode字符串指定“;,perl,unicode,Perl,Unicode,这里可能有什么问题:我收到了错误消息 新建:Unicode字符串必须在…处给定。 对于该行 $gvalue=Unicode::GCString->new($value) $values来自以下形式: for my $i ( 0 .. $#$ref ) { for my $j ( 0 .. $#{$ref->[$i]} ) { my $value = $ref->[$i][$j] // ''; # ... 到目前为止,在测试时,$ref是在脚

这里可能有什么问题:我收到了错误消息
新建:Unicode字符串必须在…处给定。

对于该行
$gvalue=Unicode::GCString->new($value)


$values
来自以下形式:

for my $i ( 0 .. $#$ref ) {
    for my $j ( 0 .. $#{$ref->[$i]} ) {
        my $value = $ref->[$i][$j] // '';
        # ...

到目前为止,在测试时,
$ref
是在脚本中硬编码的,但是它应该成为一个模块,并且
$ref
应该在例程中进行移位。

我忘了设置
使用utf8
(并且我必须显式地将
$gstring>字符串化为\u string
)。

我忘了设置
使用utf8
(我必须显式地将
$gstring->as_string
)字符串化。

Unicode::GCString遭受Unicode错误(赋予UTF8标志意义):


它要求使用UTF8=1内部存储格式存储字符串。您可以使用
UTF8::upgrade
强制将字符串设置为正确的格式,但这也可能是您忘记解码字符串的迹象。

Unicode::GCString存在Unicode错误(赋予UTF8标志含义):


它需要使用UTF8=1内部存储格式存储字符串。您可以使用
UTF8::upgrade
强制将字符串设置为正确的格式,但这也可能表示您忘记解码字符串。

对于UTF8文本和标识符,始终以
使用UTF8
开头。对于UTF8,始终以
使用UTF8
开头erals和标识符。我相信这在当前版本中是固定的。@tchirst,我有最新版本(Unicode::UCString 2011.03,来自NEZUMI/Unicode-LineBreak-2012.02.tar.gz)。我还尝试了最新的开发版本(NEZUMI/Unicode-LineBreak-2012.001_29.tar.gz)。我相信这在当前版本中是固定的。@tchirst,我有最新版本(Unicode::UCString 2011.03来自NEZUMI/Unicode-LineBreak-2012.02.tar.gz)。还尝试了最新的开发版本(NEZUMI/Unicode-LineBreak-2012.001_29.tar.gz)。我试图在Unicode::GCString模块中查找错误消息,但错误消息是在一个二进制文件中。好的,ref是如何获取其值的?我实际上是在试图追溯原始数据,以查看您是否在其他地方遇到问题。这就是为什么我总是建议人们提供完整的示例程序和输入,以演示e问题。我试图在Unicode::GCString模块中查找错误消息,但错误消息是在一个二进制文件中。好的,ref是如何获取其值的?我实际上是在试图追溯原始数据,以查看您在其他地方是否有问题。这就是为什么我总是建议人们提供完整的示例程序并输入该数据解决这个问题。
for my $i ( 0 .. $#$ref ) {
    for my $j ( 0 .. $#{$ref->[$i]} ) {
        my $value = $ref->[$i][$j] // '';
        # ...
 $ perl -MUnicode::GCString -E'
    $_=chr(0xE9);
    utf8::downgrade($_);
    Unicode::GCString->new($_);
    say "ok";
 '
 new: Unicode string must be given. at -e line 4.

 $ perl -MUnicode::GCString -E'
    $_=chr(0xE9);
    utf8::upgrade($_);
    Unicode::GCString->new($_);
    say "ok";
 '
 ok