Welcome to Delicate template
Header
Just another WordPress site
Header

フォーム送信時に文字コードを変換する方法

9月 11th, 2010 | Posted by gau in html | JavaScript

form要素に「accept-charset」属性を付加する。
例)

<form method="post" action="hoge.cgi" accept-charset="Shift_JIS">

という具合。
ちなみにIEは非対応なので、JavaScriptで対応する。

例)

<button type="submit" onclick="document.charset='euc-jp'; document.hogeform.submit(); document.charset='UTF-8';" />

みたいな感じ?
時間ができたらもう少し調べる。
参考)http://search.web-sun.com/zatu/charset.html
参考)http://gont.net/gontdo/archives/000740.html

You can follow any responses to this entry through the RSS 2.0 Both comments and pings are currently closed.