0

我想加密和编码日文文本并将其发送给将解密它的第三方。

//encryption
 $get_params = '有場'
 $encode_iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
 $encode_iv = mcrypt_create_iv($encode_iv_size,MCRYPT_RAND);
 $get_params = drupal_http_build_query($data2);  
//encode
 $encode_crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, 'b54763051cef08bc', $get_params , MCRYPT_MODE_CBC, $encode_iv);

# prepend the IV for it to be available for decryption
 $encode_crypttext =  $encode_iv.$encode_crypttext;
 $encode_get_params = base64_encode($encode_crypttext);

//decrpytion
 $decode_iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC);
 $decode_get_params = base64_decode($encode_get_params);
 $decode_iv = substr($decode_get_params, 0, $decode_iv_size);
 $dec_ciphertext = substr($decode_get_params, $decode_iv_size);
 $get_params2 =  mcrypt_decrypt(MCRYPT_RIJNDAEL_128, 'b54763051cef08bc', $dec_ciphertext, MCRYPT_MODE_CBC, $decode_iv);

问题是 get_params2 给了我 "%3F%3F " 我想返回日文字符。它适用于英文文本。base64编码有问题吗?

谢谢,

4

0 回答 0