![](/img/trans.png)
[英]Vcf to Bayescan format - perl script not recognising populations
[英]Perl scraping script not recognising certain characters
我有一個在本地運行良好但在服務器上運行失敗的腳本。
它顯示不間斷空格符號
作為
?
打印到標准輸出時。
在頁面的解析中,如果我試圖用
s/\ \;//g
什么都沒有發生,也沒有擺脫問號
s/\?//g
似乎無論如何都堅持。
奇怪的是,在本地運行腳本時這不是問題。
但是,本地計算機和服務器上的一個問題是撇號(在 HTML 中表示
´
始終表示為問號
?
即使明確嘗試
s/´/'/g
困惑,請幫助。
將嘗試像這樣刪除它:
不間斷空間
my $non_break_space = "\x{A0}";
$non_break_space =~ s/\xA0/ /g;
尖銳的口音
my $acute = "\x{B4}";
$acute =~ s/\xB4/ /g;
您可以使用此站點fileformat.info獲取有關 unicode 字符及其不同值的更多信息。
由於您用mojolicious標記了您的問題,我假設您正在使用Mojolicious 。 嘗試在您的服務器上運行此測試腳本並向我們展示結果:
#!/usr/bin/env perl
use utf8;
use Mojolicious::Lite;
use Test::More tests => 3;
use Test::Mojo;
get '/test_html' => {text => "<p>Hello World´!</p>"};
my $t = Test::Mojo->new;
$t->get_ok('/test_html')->status_is(200)->text_is('p', 'Hello World´!');
在這里工作正常:
1..3
ok 1 - get /test_html
ok 2 - 200 OK
ok 3 - exact match for selector "p"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.