<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>LEGGODT.COM &#187; 文字コード</title>
	<atom:link href="http://leggodt.com/tag/character-set/feed" rel="self" type="application/rss+xml" />
	<link>http://leggodt.com</link>
	<description>Stay hungry, Stay foolish.</description>
	<lastBuildDate>Thu, 24 May 2012 16:00:55 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>headerパワー恐るべし。</title>
		<link>http://leggodt.com/2007/02/15/header-power.html</link>
		<comments>http://leggodt.com/2007/02/15/header-power.html#comments</comments>
		<pubDate>Thu, 15 Feb 2007 04:59:35 +0000</pubDate>
		<dc:creator>ましゃ</dc:creator>
				<category><![CDATA[Notes]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[プログラミング]]></category>
		<category><![CDATA[文字コード]]></category>

		<guid isPermaLink="false">http://leggodt.net/2007/02/15/893</guid>
		<description><![CDATA[相変わらず日本語には苦労しておりますが、うちの会社のサーバーはPHPの処理がすべてEUCに統一されています。 まぁ、EUCで開発を行うときは何一つ苦労しないのだけども、どうしても違う文字コードじゃないといけない場合があり <a href='http://leggodt.com/2007/02/15/header-power.html' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>相変わらず日本語には苦労しておりますが、うちの会社のサーバーはPHPの処理がすべてEUCに統一されています。</p>
<p>まぁ、EUCで開発を行うときは何一つ苦労しないのだけども、どうしても違う文字コードじゃないといけない場合があります（うっかり違う文字コードで開発しちゃったとかなんだとか）</p>
<p>そんなときは.htaccessさんの力に頼るのですが、対外は.htaccessさんの力があれば事足ります。</p>
<p>がしかし、IE6だけは.htaccessさんのちからもなぜか及ばず、PHPファイルが、EUCではき出されてしまいます。 （CharsetがEUCって書いていなくて、違うものになっていても）</p>
<p>そんなときはPHPのコードの初っぱなに</p>
<blockquote><p>header(&#8216;Content-Type: text/html; charset=HOGEHOGE);</p></blockquote>
<p>と書いてあげるとうまくいきました。</p>
<p>頼むよIE。。<br />
<img title="Yell" src="http://www.leggodt.com/statics/TinyMCEforMT/js/tiny_mce/plugins/emotions/images/smiley-yell.gif" alt="Yell" /></p>

<a href="http://twitter.com/?status=RT%20%40%3A%20header%E3%83%91%E3%83%AF%E3%83%BC%E6%81%90%E3%82%8B%E3%81%B9%E3%81%97%E3%80%82%20-%20LEGGODT.COM%20http%3A%2F%2Fbit.ly%2FxmkrIN" class="tweet-this" ><img src="http://leggodt.com/wp-content/plugins/simple-tweet/img/tweet.gif" title="ツイート" alt="ツイート" />ツイート</a>]]></content:encoded>
			<wfw:commentRss>http://leggodt.com/2007/02/15/header-power.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPで日本語を使うのだ</title>
		<link>http://leggodt.com/2006/12/08/php-japanese.html</link>
		<comments>http://leggodt.com/2006/12/08/php-japanese.html#comments</comments>
		<pubDate>Fri, 08 Dec 2006 08:43:33 +0000</pubDate>
		<dc:creator>ましゃ</dc:creator>
				<category><![CDATA[Notes]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[プログラミング]]></category>
		<category><![CDATA[文字コード]]></category>

		<guid isPermaLink="false">http://leggodt.net/2006/12/08/882</guid>
		<description><![CDATA[新しいサーバーをいじるときに必ずやらなければ行けないこと。 それは日本語、マルチバイトテキストの設定なのだ。 そうしないと、PHPでメールを送るときにmb_encoding_mimeheaderを使ってメールのタイトルを <a href='http://leggodt.com/2006/12/08/php-japanese.html' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>新しいサーバーをいじるときに必ずやらなければ行けないこと。</p>
<p>それは日本語、マルチバイトテキストの設定なのだ。</p>
<p>そうしないと、PHPでメールを送るときにmb_encoding_mimeheaderを使ってメールのタイトルを変換したとしても、文字化けしてしまうらしい。</p>
<p><a href="http://www.akiyan.com/blog/archives/2006/03/phpmb_encode_mi.html" target="_blank">PHPのmb_encode_mimeheaderは事前にmb_internal_encodingが必要</a></p>
<p>ということらしい。</p>
<p>php.iniで設定をしても、ソース内で処理をしても良いのかな？このサイトのソースはPHP5らしいので、PHP4の人は違うかもしれませんが、いろいろと不都合が起こらないよう環境を統一しておくためにphp.iniできちんとmbの項目を設定しておきましょう。</p>
<p>ちなみに、設定した値は</p>
<blockquote><p>output_buffering         = Off<br />
magic_quotes_gpc = Off<br />
default_charset          = EUC-JP</p>
<p>mbstring.language = Japanese<br />
mbstring.internal_encoding = EUC-JP<br />
mbstring.http_input  = auto<br />
mbstring.http_output = EUC-JP<br />
mbstring.encoding_translation = On<br />
mbstring.detect_order = auto<br />
mbstring.substitute_character = none</p></blockquote>
<p>こんな感じですかね。</p>
<p>そんなこんなで仕事が滞っています。。。</p>

<a href="http://twitter.com/?status=RT%20%40%3A%20PHP%E3%81%A7%E6%97%A5%E6%9C%AC%E8%AA%9E%E3%82%92%E4%BD%BF%E3%81%86%E3%81%AE%E3%81%A0%20-%20LEGGODT.COM%20http%3A%2F%2Fbit.ly%2Fw4rkrx" class="tweet-this" ><img src="http://leggodt.com/wp-content/plugins/simple-tweet/img/tweet.gif" title="ツイート" alt="ツイート" />ツイート</a>]]></content:encoded>
			<wfw:commentRss>http://leggodt.com/2006/12/08/php-japanese.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>internal_encodingの謎</title>
		<link>http://leggodt.com/2006/04/25/internal_encoding.html</link>
		<comments>http://leggodt.com/2006/04/25/internal_encoding.html#comments</comments>
		<pubDate>Tue, 25 Apr 2006 06:36:37 +0000</pubDate>
		<dc:creator>ましゃ</dc:creator>
				<category><![CDATA[Notes]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[プログラミング]]></category>
		<category><![CDATA[文字コード]]></category>

		<guid isPermaLink="false">http://leggodt.net/2006/04/25/792</guid>
		<description><![CDATA[長年の謎であった、文字コードに解決の糸口が。。。？ どうやら、mbstring.internal_encodingとは、PHPが処理をする際の文字コードのようで、たとえば、formの表示する部分をShift_jisで作っ <a href='http://leggodt.com/2006/04/25/internal_encoding.html' class='excerpt-more'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>長年の謎であった、文字コードに解決の糸口が。。。？</p>
<p>どうやら、mbstring.internal_encodingとは、PHPが処理をする際の文字コードのようで、たとえば、formの表示する部分をShift_jisで作ってしまった場合も</p>
<ul>
<li>form.html  -  Shift_jis</li>
<li>confirm.php &#8211; EUC-jp</li>
<li>send.php &#8211; EUC-jp</li>
</ul>
<p>というように受取側が、EUCであれば問題がないようだ。</p>
<p>但し、confirm.phpにおいて、表示する際は、charsetはShift_jisでありながら、ファイル自体はEUC-ｊｐで保存しないといけないので要注意。</p>
<p>とりあえず、今回はこれでうまく行った感じだけど、どうなることやら。。。（というか、うちの会社のサーバーのみかもしれないし。。。）</p>
<p><span id="more-792"></span></p>
<p>ちなみに、.htaccessには、こう書きました。</p>
<blockquote><p>&lt;IfModule mod_php4.c&gt;<br />
php_flag    register_globals            off<br />
php_flag    output_buffering            off<br />
php_value    session.save_handler    files<br />
php_value    mbstring.language            Japanese<br />
php_value    mbstring.internal_encoding    EUC-JP<br />
php_value    mbstring.http_input        auto<br />
php_value    mbstring.http_output    SJIS<br />
php_flag    mbstring.encoding_translation    on<br />
php_flag    mbstring.detect_order    auto<br />
php_flag    mbstring.substitute_character    none<br />
&lt;/IfModule&gt;</p></blockquote>

<a href="http://twitter.com/?status=RT%20%40%3A%20internal_encoding%E3%81%AE%E8%AC%8E%20-%20LEGGODT.COM%20http%3A%2F%2Fbit.ly%2FzEX4xR" class="tweet-this" ><img src="http://leggodt.com/wp-content/plugins/simple-tweet/img/tweet.gif" title="ツイート" alt="ツイート" />ツイート</a>]]></content:encoded>
			<wfw:commentRss>http://leggodt.com/2006/04/25/internal_encoding.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

