-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98ac501
commit 26d4e7f
Showing
5 changed files
with
93 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,32 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: ryuji | ||
* Date: 2015/11/26 | ||
* Time: 16:44 | ||
* NetCommonsFile | ||
* | ||
* @author Ryuji AMANO <ryuji@ryus.co.jp> | ||
* @link http://www.netcommons.org NetCommons Project | ||
* @license http://www.netcommons.org/license.txt NetCommons License | ||
*/ | ||
|
||
App::uses('TemporaryFile', 'Files.Utility'); | ||
|
||
/** | ||
* Class NetCommonsFile | ||
*/ | ||
class NetCommonsFile { | ||
public static function convertSjisWin2Utf8($filePath) { | ||
|
||
/** | ||
* 指定されたファイルの文字コードをSjis-winからUTF-8に変換したテンポラリファイルを作成して返す | ||
* | ||
* @param string $filePath ファイルパス | ||
* @return TemporaryFile 文字コードをUTF8に変換したテンポラリファイル | ||
*/ | ||
public static function getTemporaryFileConvertSjisWin2Utf8($filePath) { | ||
$tmp = new TemporaryFile(); | ||
$fp = fopen($filePath, 'r'); | ||
while(($line = fgets($fp)) !== false){ | ||
while (($line = fgets($fp)) !== false) { | ||
$line = mb_convert_encoding($line, 'UTF-8', 'sjis-win'); | ||
$tmp->append($line); | ||
} | ||
return $tmp; | ||
} | ||
|
||
public static function getTemporaryFileConvertSjisWin2Utf8($filePath) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters