記錄一些平時可能會用到的。
Python(將中文轉化爲unicode編碼)
# -*- coding: utf-8 -*- line ="在頁面輸入" print line.decode('utf-8').encode('unicode-escape').replace('\\u',';&#x')
Perl(根據獲取的unicode編碼進行字符串操作)
對於中文字符串匹配
my $claimCodeText = "\x{7ed3}\x{8d26}\x{65f6}\x{8f93}\x{5165}"; my $pos = rindex($fullDescription, $claimCodeText);
對於print中文
my $haveExpriedCoupon = "已过期"; print $haveExpriedCoupon;
JS
var shortMessage = encodeURIComponent(shortStr);