アシノスキマ A monologue of giraffe.LA (jimdo) web top

モバイルサイト_メモ_#01_meta_文字コード

☆xml宣言

docomoでは省略できなかったりもします。

 

PC用サイトを作るときに、普通に記載してる部分なので、違和感はなし。

ほかのキャリアでもあってもいいので、とりあへず全部かく。


<?xml version="1.0" encoding="{if $SJIS}Shift_JIS{else}utf-8{/if}"?>

※phpでキャリアなどに対していろいろ切り替えをしている。


<?xml version="1.0" encoding="Shift_JIS"?>

※文字コードShift_JIS docomo・au


<?xml version="1.0" encoding="utf-8"?>

※文字コードutf-8 softbank

どっちかというとはまったのはこっち。

※xml宣言がこの状態のとき。

<?xml version="1.0" encoding="{if $SJIS}Shift_JIS{else}utf-8{/if}"?>

 

 

<meta http-equiv="content-type" content="application/xhtml+xml; charset=Shift_JIS" />

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />

これをAGENTで表示切替を分岐させていたのですが、

Dreamwearverで開くと何故か、文字化け。

システムさんと連携作業をしていて、ほかエディタでひらかないと文字化けするとか意味不明。


utf-8ファイルのはずのファイル。

DWの環境設定でも、エンコーディング指定がないファイルを開くときに、utf-8を使用するに、チェックが入っている。


でも、化ける。

何故だろう?
とこまった結果、どうやら表記順が問題だったよう。


docomo・au Shift_JIS softbank utf-8で、AGENT分岐も
docomo

au

softbank

にしていたための模様。



つまり、こんな風にしていたのですが、↓

{if $AGENT == "docomo"}

<meta http-equiv="content-type" content="application/xhtml+xml; charset=Shift_JIS" /><meta name="prohibition" content="image" />

{elseif $AGENT == "au"}

<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />

<meta http-equiv="Cache-Control" content="no-cache" />

{elseif $AGENT == "softbank"}

<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />{else}<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />{/if}

これで、ソース上最初にいる charset=Shift_JIS を判定するようだったのです。(面倒)


まぁ、表記の順番をかえるだけで解決。↓
{if $AGENT == "softbank"}

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

{elseif $AGENT == "au"}

<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />

<meta http-equiv="Cache-Control" content="no-cache" />

{elseif $AGENT == "docomo"}

<meta http-equiv="content-type" content="application/xhtml+xml; charset=Shift_JIS" />

<meta name="prohibition" content="image" />

{else}

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

{/if}

※<meta http-equiv="Cache-Control" content="no-cache" />

auでのキャッシュコントロール用。


※<meta name="prohibition" content="image" />

docomoでの画像登録を禁止するためのもの。

cssとかの感覚でいくと、ウェイトが同じであれば、最後のものでリライトされるぽいイメージだったので、目からうろこでした。
というか面倒だよね

metaのAGNET分岐。

コメントをお書きください

コメント: 2
  • #1

    Osborn (日曜日, 22 7月 2012 11:12)

    I was looking for something similar, I am very grateful you have shared this subject

  • #2

    buytadalafilonline (火曜日, 06 11月 2012 22:43)

    I intended to draft you this bit of remark in order to say thank you once again for the pretty guidelines you've documented here. It is quite strangely open-handed of you to present unhampered precisely what a lot of people could have made available as an electronic book to generate some cash for themselves, and in particular now that you could have tried it if you decided. Those good tips likewise served as a good way to recognize that some people have a similar dream the same as my personal own to understand a whole lot more concerning this condition. I am sure there are lots of more fun periods ahead for many who take a look at your website.

jump_top