人çã«ä¸åº¦æ¥ãã¨ãã RFC èªã¿ããæã®ç¬¬ä¸æ
ä½ãã¨ã¡çã£ãã®ããä»äºã®æ¯æãã« RFC ãèªãã§ãã¾ããããã¯äººçã«ä¸åº¦æ¥ãã¨ãã RFC èªã¿ããæã«çªå
¥ããã¨è¨ã£ã¦è¯ãã§ãããã
ã§ãä½ã® RFC ãèªãã§ãããã¨ããã¨ãã¡ã¼ã«ã®æ·»ä»ãã¡ã¤ã«åã«ã¤ãã¦ã®ãã©ã¼ããã
ããã辺ãè¦ã¦ããã®ã ãã©ãããå°ãç´ äººã«ãåªãããã¼ã¸
ã³ã³ãè¦ã¦è§£èªä¸ã
ä½è«
Thunderbird 1.5 ãã§ãã°ããã®é ã¯ããã® RFC2231 ã«æºæ ãããã¡ã¤ã«åã解éã§ããã¡ã¼ã©ã¼ã¯å¤ããªãã£ãããã§ããXXããã®ã¡ã¼ã«ã«ã¤ãã¦ãæ·»ä»ãã¡ã¤ã«ãèªãã¾ããï¼ï¼ãã¿ãããªäºããã£ããããªã
ã§ããã®æã®ãã¡ã¤ã«åã£ã¦ã®ã RFC2322 ã«æºæ ããå¤æããã¦ããã»ã»ã»ã¯ãã ãã©ãå¾®å¦ã«ééã£ã¦ãããããã
以ä¸ãè¦ãã¨ãä¸ç®çç¶ã§ããã¡ã¤ã«åãæãè¿ãéã®è¡æ«ã¯ã»ãã³ãã³ã§åºåãã¯ãããæ¹è¡ã®ã¿ã§åºåããã¦ããã¨ãã件ã
ã¡ãªã¿ã«ãç¾å¨ãèªåã®ä½¿ã£ã¦ãã Thunderbird 2.0ï¼MacOSXçï¼ã§ã¯æ£ããã»ãã³ãã³ã§åºåããã¦ããããã§ãã
é話ä¼é¡
ã§ã RFC ãèªãã§ããããã ãã©ãé常ã«ãããã«ããããªã®ã§ãæ¥æ¬èªã®è§£èª¬ãã¼ã¸ã辺ãããã³ã¼ãæ¹æ³ãèããã
ä¾ãã°ãJapanese Filename ããã§ã®ä¾ã¨ãã¦ã以ä¸ã®ãããªæååãç¾ããã¦ãã*1ã
Content-Disposition: attachment;
filename*=iso-2022-jp'ja'%1B%24B%24%5B%244%24%5B%242%1B%28B.jpeg
ããããã»ãã»ã.jpegãã¨ãªãããã ã
ã¨ãããããfilename* ã®è§£éã¨ããiso-2022-jp ã¨ãæ¸ãã¦ããé¨åã¯ç¡è¦ãã¦ãæ¬æé¨åï¼ã¤ã¾ãããã»ãã»ã.jpegãã®é¨åï¼ãã©ã解éããã°è¯ãã®ããèããã
%1B%24B%24%5B%244%24%5B%242%1B%28B.jpeg
ãããã
ã¾ãæåã«ããªãã¨ãªãã¤ã¡ã¼ã¸ã¨ãã¦ãæåã³ã¼ãã ISO2022-JP*2ã§ãããã¨ãããæ¼¢åINãæ¼¢åOUTã¨è¨ã£ãJISæ¼¢åã³ã¼ããå«ã¾ããäºãæ³åã§ããã
ã¨ãã訳ã§ãã©ã®ããã«è§£éãã¦ãããã¨è¨ãã¨ã»ã»ã»
- %ãããé¨å㯠16 é²æ°ã®äºæ¡ã ã
- å ã è±æ°åã®ãã®ã¯ãã®ã¾ã¾ã ã
ã¨ãã風ã«è¦ããã¤ã¾ãã16é²æ°ã®æåãã16é²æ°ã§ã¯ãªãæåã®ã©ã¡ãããçå´ã«åããã¦ãããå¿
è¦ãããï¼ãããããã»ã»ã»ï¼ã
ä¾ãã°ã16é²æ°é¨åï¼%XXï¼ãæåå*3ã«æ»ãã¦ãããã°ãæ®éã®æåã³ã¼ãï¼JISã³ã¼ãï¼ã®æååã«ãªãã¯ãã§ããã
ã¨ããããã§ã ruby ã§æ¸ãã¦ã¿ããã»ã»ã»ã¨ããããæ¸ãã«è³ãã¾ã§ã«2æéãããæãã£ãï¼¼(^o^)ï¼
ãã¸ãã¯çã«ã¯åãã£ããã ãã©ãåºæ°å¤æã¨ããã£ã¦ãã¨ããããããªããªãããï¼ï¼
irb(main):150:0* str = '%1B%24B%24%5B%244%24%5B%242%1B%28B.jpeg' => "%1B%24B%24%5B%244%24%5B%242%1B%28B.jpeg" irb(main):151:0> str.gsub(/%([\dA-F][\dA-F])/i) { $1.to_i(16).chr } => "\e$B$[$4$[$2\e(B.jpeg"
ã¨ããããã%ã®æ¬¡ã®äºæåãåãã®ã¯ããã«ã§ãããã ãã©ããããã©ããã£ã¦æåã«æ»ãã®ãããããããã¯ã§ããããã
ã£ã¦ãã gsub ã¨ãä¹
ãã¶ãã«ã¤ãã£ãæ°ãããï¼
ã§ããããªæãã®æååã«ãªã£ãã®ã ãã©ãããã§ã¯å¸¸äººã«ã¯èªããªããã¨ãããããæåã³ã¼ãã UTF-8 ã«ãã¦ã¿ãã
irb(main):153:0* res = str.gsub(/%([\dA-F][\dA-F])/i) { $1.to_i(16).chr } => "\e$B$[$4$[$2\e(B.jpeg" irb(main):154:0> $KCODE='u' => "u" irb(main):155:0> NKF.nkf("-w", res) => "ã»ãã»ã.jpeg"
ããããèªããï¼
ã¨ããããã§
ãã¾ãäº %ã® 16é²æ°ãæãåºãã¦ããã®å¤ãã¢ã¹ãã¼ã³ã¼ã表ã«åºã¥ãã¦å¤æãã¦ãããã¨ãå
ã®æååã«ã§ãã¾ããã
ããç°¡åã§ãããï¼