User:
Pass:
Keep:   
Xoops Cube Project
XOOPS Cube Project Site
Powered by Google



Powered by XOOPS Cube Legacy 2.1.6a
PukiWikiMod 1.5.1
WordPress Module 0.6.0 Alpha

2004年6月20日(日)

トラックバックの文字化け対策

カテゴリー: - のぶのぶ @ 12時26分14秒

日本語の文字コードの関係でトラックバックの文字化けってのがいろいろな
ブログツールの開発者を悩ましているが、試行錯誤の結果WordPressでは、
以下のような対策を考えた。

トラックバック送信時
1.charsetパラメータの付加
 日本語圏では、charsetをトラックバックPOSTのパラメータに付加する事が
 デファクトとなっているようなので、送信する文字コードを指定する。
2.UTF-8での送信オプションの追加
 exciteのブログなどではUTF-8以外の文字コードによるトラックバックを
 受け付けてくれないので、送信時にUTF-8によるトラックバックを可能にする
 オプションを追加
3.Bookmarkletによる投稿時の、ターゲットの文字コード自動判定
 Bookmarkletによる投稿時には、一度トラックバックURLの自動取得を目的として
 ターゲットのページを読み込むようにしているので、この際に文字コードを
 判定して、その文字コードによってトラックバックを送信する。

トラックバック受信時
基本的には以下の2つの方法で受信したトラックバックの文字コードを判定する。
1.charsetパラメータによる文字コード判定
2.mb_detect_encoding関数による文字コード判定
但し、PHPではphp.iniや.htaccess等によりmbstringの設定の違いによって、
charsetパラメータを信用する事がかえって文字化けの原因となる事が
わかってきた。
というのは、設定によってはPHPの方で自動的にPOSTされた文字列の文字コードを
判定して、事前に文字コード変換されてしまうので、これにcharsetパラメータを
参照して文字コード変換すると2重に変換する事になって文字化けが発生してしまう。
特にphp.iniにて、

mbstring.http_input = auto
mbstring.encodi​ng_translation = On

等となっている場合には、この状況となる。
よって、受信時に既に変換済みかどうかを判定する必要が出てくる。
mb_http_input("P")という関数呼び出しによって、POST文字列をどういうcharsetとして
判断して変換したかという事が拾えるので、これらとphp.iniの設定内容を元に、
自動変換するかcharsetパラメータによる変換をするかを判定する事とした。


コメント

このコメントのRSS

TrackBack URL : http://www.kowa.org/modules/wordpress/archives/2004/06/20/224/trackback/

  1. 日記更新
    きこえる

    Comment by のぶのぶ — 2004年7月25日(日) @ 10時39分07秒

  2. テスト
    http://www.kowa​.org/modules/wo​rdpress/archive​s/2004/06/20/22​4/
    テストです。

    Trackback by M's_Bar — 2005年6月14日(火) @ 22時16分20秒

  3. この文字化け対策はありがたいです。

    Comment by 人材派遣労働者 — 2008年2月17日(日) @ 15時24分55秒

  4. htaccessで設定できることを初めて知りました。

    Comment by 会社設立したばかり — 2008年6月18日(水) @ 10時07分40秒

  5. ckbV6d Great topic, nice message. Thank you.,

    Comment by Frank Rasmussen — 2009年7月9日(木) @ 22時19分58秒

  6. JvNWoQ cool, i will bookmark it,

    Comment by Rick Chiu — 2009年7月11日(土) @ 00時11分43秒

  7. thank you this topic,

    Comment by Francis Acosta — 2009年7月11日(土) @ 00時14分46秒

  8. thank you this topic,

    Comment by Francis Acosta — 2009年7月11日(土) @ 00時15分23秒

  9. Thank you for this site, such as multi information.I! Thank you!,

    Comment by nomad — 2009年7月11日(土) @ 00時14分03秒

  10. great site. I love online games,

    Comment by kevin parshall — 2009年7月11日(土) @ 00時16分05秒

  11. YNxmID what gives you that idea?,

    Comment by Jenny Nadler — 2009年7月11日(土) @ 18時07分27秒

  12. YNxmID what gives you that idea?,

    Comment by Jenny Nadler — 2009年7月11日(土) @ 18時06分52秒

  13. what gives you that idea?,

    Comment by jeanette jepson — 2009年7月11日(土) @ 18時08分09秒

  14. Bravo! Nice Article.,

    Comment by skip guthrie — 2009年7月11日(土) @ 18時08分45秒

  15. Very interesting!I壇 like to see how far he goes and how well the word will get out.,

    Comment by Grover Sonnier — 2009年7月11日(土) @ 18時09分55秒

  16. Thank you! I liked the article! I love how you write beautifully.,

    Comment by jamie hamner — 2009年7月11日(土) @ 18時09分20秒

  17. Very interesting!I壇 like to see how far he goes and how well the word will get out.,

    Comment by Grover Sonnier — 2009年7月11日(土) @ 18時10分21秒

  18. Very interesting!I壇 like to see how far he goes and how well the word will get out.,

    Comment by Grover Sonnier — 2009年7月11日(土) @ 18時10分56秒

  19. wNxA1M I will go to you.,

    Comment by Piseth Khun — 2009年7月14日(火) @ 06時58分47秒

  20. thank you dear friend,

    Comment by Ryan Gilbert — 2009年7月14日(火) @ 06時59分33秒

  21. thank you dear friend,

    Comment by Rita — 2009年7月14日(火) @ 07時02分49秒

  22. Hey! I just searched for and I found your site!,

    Comment by Tom Junius — 2009年7月14日(火) @ 07時02分11秒

  23. what gives you that idea?,

    Comment by VICTORIA MATTSON — 2009年7月14日(火) @ 07時03分27秒

  24. Bravo! Nice Article.,

    Comment by Danny Garmon — 2009年7月14日(火) @ 07時04分03秒

  25. I think its good decision what he did.,

    Comment by Chris Moffett — 2009年7月14日(火) @ 07時04分40秒

  26. Hey! I just searched for and I found your site!,

    Comment by DAWN VERNON — 2009年7月14日(火) @ 07時05分18秒

  27. thanks for you.. nice good document!,

    Comment by Alycia Harhai — 2009年7月14日(火) @ 07時06分31秒

  28. nice job, very thanks?

    Comment by Michael Pruckner — 2009年7月14日(火) @ 07時07分08秒

  29. Thanks this design is very good..,

    Comment by Kristen Sando — 2009年7月14日(火) @ 07時07分44秒

  30. Cool Info, practical.. lol,

    Comment by Alexandra Zeigler — 2009年7月14日(火) @ 07時08分19秒

  31. GXeA3J Oh hell yeah no graphical smilies around here.,

    Comment by lana rodriguez — 2009年7月14日(火) @ 14時21分52秒

  32. GXeA3J Oh hell yeah no graphical smilies around here.,

    Comment by lana rodriguez — 2009年7月14日(火) @ 14時22分28秒

  33. Good Thank you It痴 very beautifully,

    Comment by Barbara Pecor — 2009年7月14日(火) @ 14時23分13秒

  34. sX7HZx Hey! I just searched for and I found your site!,

    Comment by white black — 2009年7月14日(火) @ 14時23分43秒

  35. Good Thank you It痴 very beautifully,

    Comment by Bryan Dorynek — 2009年7月14日(火) @ 14時23分52秒

  36. Very interesting!I壇 like to see how far he goes and how well the word will get out.,

    Comment by Eileen Smith — 2009年7月14日(火) @ 14時24分29秒

  37. Great work Thanks for your ideas.,

    Comment by Matthew Walloch — 2009年7月14日(火) @ 14時25分17秒

  38. Great work Thanks for your ideas.,

    Comment by Matthew Walloch — 2009年7月14日(火) @ 14時25分53秒

  39. cool, i will bookmark it,

    Comment by Nichole Boyd — 2009年7月14日(火) @ 14時26分34秒

  40. Thank you for this site, such as multi information.I! Thank you!,

    Comment by lori moss — 2009年7月14日(火) @ 14時27分15秒

  41. thanks for you.. nice good document!,

    Comment by Jason Vetter — 2009年7月14日(火) @ 14時27分58秒

  42. thanks for you.. nice good document!,

    Comment by Jason Vetter — 2009年7月14日(火) @ 14時28分34秒

  43. what gives you that idea?,

    Comment by Victoria Marquez — 2009年7月21日(火) @ 12時33分17秒

  44. Hi can someone please translate for me thanx,

    Comment by Tiffany Buchanan — 2009年7月21日(火) @ 12時34分03秒

  45. great site. I love online games,

    Comment by Jess — 2009年7月21日(火) @ 12時34分48秒

  46. nice job, very thanks

    Comment by mikadiva — 2009年7月21日(火) @ 12時35分31秒

コメントの投稿

改行や段落は自動です
URLとメールアドレスは自動的にリンクされますので、<a>タグは不要です。
以下のHTMLタグが使用可能です。
<a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <br> <code> <em> <i> <strike> <strong>


:-D :-) :-( :-o :-? 8-) :lol: :-x :-P :oops: :cry: :evil: :roll: ;-) :pint: :hammer: :idea: ::ttt::

118 queries. 0.533 sec. - Mem:11411bytes
Powered by WordPress Module based on WordPress ME & WordPress

カレンダー
2004年 6月
« 5月   7月 »
 12345
6789101112
13141516171819
20212223242526
27282930  
投稿者別一覧
アーカイブ(月別)
カテゴリ一覧
ブログ内検索