日記帳
本ページはプロモーションが含まれています
カテゴリー
Links
blog(ブログ)マスター
アンドロイドの巣
ゼロから始めるベランダ菜園
タイトル
ラジコン
2024年5月
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31

phpのバグ dirname関数は日本語対応未熟(php 5.3)

2010-11-29
phpのバグ dirname関数は日本語対応未熟(php 5.3)

php6は、正常に動作しましたが

現行のバージョンは以下のコードでエラーが起きます
UTF8の文字に対してdirnameは、問題ないですが
現状 utf8でファイル名を取得できるのか?

// bug: php 5.3.3 , 5.2.14
// (php6:ok)

mb_language("ja");
mb_internal_encoding("SJIS");

$path = "c:\\tmp\\".chr(0x83).chr(0x8b); // japanese common charset (katakana ru)
$file = $path."\\test.txt"; // c:\tmp\ル\test.txt
printf(" \$file : %s\n" , $file);
printf(" dirname(\$file) : %s\n\n" , dirname($file));

if ( strcasecmp($path , dirname($file)) != 0 ) exit(" error : bug\n");

print "ok \n";
?>

出力結果

$file : c:\tmp\ル\test.txt
dirname($file) : c:\tmp

error : bug

本来あるべき値 c:\tmp\ル

Amazon search for: php

 関連記事はありません。

ブログ内 関連記事: phpのバグ dirname関数は日本語対応未熟 (php 5.3)


ブログ内 関連記事: phpのバグ dirname関数は日本語対応未熟 (php 5.3)

Amazon search for: php

 関連記事はありません。
トラックバック
トラックバックはありません。
PR

[PR]