问题
I am working on a site that is trying pass a japanese item name to paypal through this form
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input name="cmd" value="_xclick" type="hidden">
<input name="item_name" value="フォトグラフィー基礎コース" type="hidden">
<input name="amount" value="59000" type="hidden">
<input name="currency_code" value="JPY" type="hidden">
<input type="hidden" name="item_number" value="PHP001">
<input name="no_note" value="0" type="hidden">
<input type="hidden" name="lc" value="ja_JP">
<input name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest" type="hidden">
<input class="coursepayment" name="submit" value="今すぐ購入" alt="PayPal - The safer, easier way to pay online!" border="0" type="submit">
</form>
But the Item name comes out reading: フォトグラフィー基礎コース Is there a way to fix this?
回答1:
See the documentation for the form method: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/formbasics/#setting-the-character-set--charset
Setting the Character Set — charset
Use the charset HTML variable to specify the character set and character encoding for the billing information/log-in page on the PayPal website. In addition, this variable sets the same values for information that you send to PayPal in your HTML button code.
For example, the following INPUT tag sets the encoding to UTF-8:
<INPUT TYPE="hidden" name="charset" value="utf-8">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input name="cmd" value="_xclick" type="hidden">
<input type="hidden" name="charset" value="utf-8">
<input name="item_name" value="フォトグラフィー基礎コース" type="hidden">
<input name="amount" value="59000" type="hidden">
<input name="currency_code" value="JPY" type="hidden">
<input type="hidden" name="item_number" value="PHP001">
<input name="no_note" value="0" type="hidden">
<input type="hidden" name="lc" value="ja_JP">
<input name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest" type="hidden">
<input class="coursepayment" name="submit" value="今すぐ購入" alt="PayPal - The safer, easier way to pay online!" border="0" type="submit">
</form>
回答2:
Another alternative is to set the default encoding accepted by the PayPal account (which as of today is still not utf-8 until you set it that way).
Check "More Options" under https://www.paypal.com/cgi-bin/customerprofileweb?cmd=_profile-language-encoding
来源:https://stackoverflow.com/questions/34634417/www-paypal-com-jp-cgi-bin-webscr-item-name-encoding