Php 加密波斯消息

Php 加密波斯消息,php,encryption,aes,Php,Encryption,Aes,我的新messenger有问题。 我想加密用户的邮件。 如果他们输入波斯语,我无法加密。 这些未定义的符号(如:�) 是我的问题吗 我如何处理它? 我的加密码 function encrypt($message){ // Store a string into the variable which // need to be Encrypted $simple_string = $message; // Store the cipher method $cipheri

我的新messenger有问题。
我想加密用户的邮件。
如果他们输入波斯语,我无法加密。

这些未定义的符号(如:�) 是我的问题吗
我如何处理它?

我的加密码

function encrypt($message){
    // Store a string into the variable which
// need to be Encrypted
    $simple_string = $message;

// Store the cipher method
    $ciphering = "AES-128-CTR";

// Use OpenSSl Encryption method
    $iv_length = openssl_cipher_iv_length($ciphering);
    $options = 0;

// Non-NULL Initialization Vector for encryption
    $encryption_iv = '1234567891011121';

// Store the encryption key
    $encryption_key = "SparkSocial";

// Use openssl_encrypt() function to encrypt the data
    $encryption = openssl_encrypt($simple_string, $ciphering,
        $encryption_key, $options, $encryption_iv);
    return $encryption;
}

function decrypt($code){
    // Store the cipher method
    $ciphering = "AES-128-CTR";

    // Non-NULL Initialization Vector for decryption
    $decryption_iv = '1234567891011121';

// Store the decryption key
    $decryption_key = "SparkSocial";

    $options = 0;

    $decryption=openssl_decrypt ($code, $ciphering,
        $decryption_key, $options, $decryption_iv);

    return $decryption;
}

代码的快速运行表明,没有问题

function encrypt($message){
// Store a string into the variable which
// need to be Encrypted
    $simple_string = $message;

// Store the cipher method
    $ciphering = "AES-128-CTR";

// Use OpenSSl Encryption method
    $iv_length = openssl_cipher_iv_length($ciphering);
    $options = 0;

// Non-NULL Initialization Vector for encryption
    $encryption_iv = '1234567891011121';

// Store the encryption key
    $encryption_key = "SparkSocial";

// Use openssl_encrypt() function to encrypt the data
    $encryption = openssl_encrypt($simple_string, $ciphering,
        $encryption_key, $options, $encryption_iv);
    return $encryption;
}

function decrypt($code){
    // Store the cipher method
    $ciphering = "AES-128-CTR";

    // Non-NULL Initialization Vector for decryption
    $decryption_iv = '1234567891011121';

// Store the decryption key
    $decryption_key = "SparkSocial";

    $options = 0;

    $decryption=openssl_decrypt ($code, $ciphering,
        $decryption_key, $options, $decryption_iv);

    return $decryption;
}

$a = encrypt("الف");
$b = decrypt($a);
echo $b;
输出:

الف 
因此,如果没有进一步的信息,我建议您查看