我必须做一个带有土耳其内容的项目。在我的python 3.6.5的ubuntu机器中,我对此没有任何问题。但是在生产服务器中,这是具有相同python 3.6.2的debian机器,我有:
<?php
function getCheckSum($MerchantId,$Amount,$OrderId ,$URL,$WorkingKey)
{
$str ="$MerchantId|$OrderId|$Amount|$URL|$WorkingKey";
$adler = 1;
$adler = adler32($adler,$str);
return $adler;
}
function verifyCheckSum($MerchantId,$OrderId,$Amount,$AuthDesc,$CheckSum,$WorkingKey)
{
$str = "$MerchantId|$OrderId|$Amount|$AuthDesc|$WorkingKey";
$adler = 1;
$adler = adler32($adler,$str);
if($adler == $CheckSum)
return "true" ;
else
return "false" ;
}
function adler32($adler , $str)
{
$BASE = 65521 ;
$s1 = $adler & 0xffff ;
$s2 = ($adler >> 16) & 0xffff;
for($i = 0 ; $i < strlen($str) ; $i++)
{
$s1 = ($s1 + Ord($str[$i])) % $BASE ;
$s2 = ($s2 + $s1) % $BASE ;
//echo "s1 : $s1 <BR> s2 : $s2 <BR>";
}
return leftshift($s2 , 16) + $s1;
}
function leftshift($str , $num)
{
$str = DecBin($str);
for( $i = 0 ; $i < (64 - strlen($str)) ; $i++)
$str = "0".$str ;
for($i = 0 ; $i < $num ; $i++)
{
$str = $str."0";
$str = substr($str , 1 ) ;
//echo "str : $str <BR>";
}
return cdec($str) ;
}
function cdec($num)
{
for ($n = 0 ; $n < strlen($num) ; $n++)
{
$temp = $num[$n] ;
$dec = $dec + $temp*pow(2 , strlen($num) - $n - 1);
}
return $dec;
}
$Merchant_Id = /*merchant_id*/ ;
$Amount = '1000';
$Order_Id = "ORDER102030sd40";
$Redirect_Url = //redirecturl;
$WorkingKey = /*working key*/ ;
$customer_name = 'Sai';
$Checksum = getCheckSum($Merchant_Id,$Amount,$Order_Id ,$Redirect_Url,$WorkingKey);
$delivery_cust_address= 'Chennai';
$billing_cust_name= 'Sai';
$billing_cust_country= 'India';
$billing_cust_state= 'Tamilnadu';
$billing_cust_city= 'Chennai';
$billing_zip= '600056';
$billing_cust_tel= '9003321521';
$billing_cust_email= 'sai@gmail';
$delivery_cust_name= 'Sai';
$delivery_cust_country= 'India';
$delivery_cust_state= 'Tamilnadu';
$delivery_cust_city= 'Chennai';
$delivery_zip= '600056';
$delivery_cust_tel= '9003321521';
$delivery_cust_email= 'sai@gmail';
?>
<form name="paymentform" method="post" action="https://test.ccavenue.com/transaction/transaction.do?command=initiateTransaction">
<input type="text" name="merchant_id" value="<?php echo $Merchant_Id; ?>">
<input type="text" name="amount" value="<?php echo $Amount; ?>">
<input type="text" name="order_id" value="<?php echo $Order_Id; ?>">
<input type="text" name="redirect_url" value="<?php echo $Redirect_Url; ?>">
<input type="text" name="checksum" value="<?php echo $Checksum; ?>">
<input type="text" name="billing_cust_name" value="<?php echo $billing_cust_name; ?>">
<input type="text" name="billing_cust_address" value="<?php echo $delivery_cust_address; ?>">
<input type="text" name="billing_cust_country" value="<?php echo $billing_cust_country; ?>">
<input type="text" name="billing_cust_state" value="<?php echo $billing_cust_state; ?>">
<input type="text" name="billing_zip" value="<?php echo $billing_zip; ?>">
<input type="text" name="billing_cust_tel" value="<?php echo $billing_cust_tel; ?>">
<input type="text" name="billing_cust_email" value="<?php echo $billing_cust_email; ?>">
<input type="text" name="delivery_cust_name" value="<?php echo $delivery_cust_name; ?>">
<input type="text" name="delivery_cust_address" value="<?php echo $delivery_cust_address; ?>">
<input type="text" name="delivery_cust_country" value="<?php echo $delivery_cust_country; ?>">
<input type="text" name="delivery_cust_state" value="<?php echo $delivery_cust_state; ?>">
<input type="text" name="delivery_cust_tel" value="<?php echo $delivery_cust_tel; ?>">
<input type="submit" value="submit">
</form>
当我将SyntaxError: Non-UTF-8 code starting with ....
用作docs时,我有:
# -*- coding: utf-8 -*-
我整天都在搜索google和stackoverflow。并尝试所有建议。 有关此问题的任何建议将不胜感激。