「ファイルをUTF-8にコンバートする」の版間の差分
Mitsuhiro Yoshida (トーク | 投稿記録) (→方法1) |
Mitsuhiro Yoshida (トーク | 投稿記録) (→方法1) |
||
16行目: | 16行目: | ||
=== 方法1 === | === 方法1 === | ||
* フラットファイルをサクラエディタ (http://sakura_editor.at.infoseek.co.jp/) | * フラットファイルをサクラエディタ (http://sakura_editor.at.infoseek.co.jp/) で開いてください。 | ||
* ファイル (F) >> 名前を付けて保存 (A) | * ファイル (F) >> 名前を付けて保存 (A) を選択してください。 | ||
* 文字コードセットをUTF-8、改行コードをLF (Unix) | * 文字コードセットをUTF-8、改行コードをLF (Unix) にしてください。 | ||
* 保存 (S) | * 保存 (S) をクリックして、ファイルを保存してください。 | ||
または | または | ||
* フラットファイルをPSPad (http://www.pspad.com) | * フラットファイルをPSPad (http://www.pspad.com) で開いてください。 | ||
* Formatメニューをクリックして、UTF- | * Formatメニューをクリックして、UTF-8を選択してください。 | ||
* | * ファイルを保存してください。 | ||
=== 方法2 === | === 方法2 === |
2008年8月12日 (火) 20:49時点における版
Moodle 1.6
作成中です - Mitsuhiro Yoshida 2008年8月10日 (日) 15:11 (CDT)
カスタム言語パック、またはサードパーティモジュールの言語ファイル等は、Moodle 1.6のUTF-8データベースで使用する前に、UTF-8にコンバートする必要があります。
*nix likeコンピュータ (Mac OS Xを含む)
一般的にUnix、Linux、Macの「iconv」コマンドを使用してコンバートします。
iconv -f original_charset -t utf-8 originalfile > newfile
Windowsコンピュータに関する説明もご覧ください - ここでのスクリプトは*nixコンピュータのものですが、cygwin環境で使用します。
Windowsコンピュータ
Windowsでは、UTF-8へのコンバートに3つの方法があります。
方法1
- フラットファイルをサクラエディタ (http://sakura_editor.at.infoseek.co.jp/) で開いてください。
- ファイル (F) >> 名前を付けて保存 (A) を選択してください。
- 文字コードセットをUTF-8、改行コードをLF (Unix) にしてください。
- 保存 (S) をクリックして、ファイルを保存してください。
または
- フラットファイルをPSPad (http://www.pspad.com) で開いてください。
- Formatメニューをクリックして、UTF-8を選択してください。
- ファイルを保存してください。
方法2
Download the Windows version of the iconv program. Download the "Complete package, except source" and run the setup program. The executable is located in the bin folder. Run from the command prompt (Start -> Run -> cmd) and follow the instructions as above.
方法3
The conversion may also be done by using Cygwin, a Linux-like environment for Windows, and excecuting the iconv command in that environment. Here is an example of a working solution on Windows with Cygwin:
- Create a text file, named ToUtf8.txt
- Fill it with the following code
#!/bin/bash FROM=iso-8859-1 TO=UTF-8 ICONV="iconv -f $FROM -t $TO" # Convert find ToUTF/ -type f -name "*" | while read fn; do cp ${fn} ${fn}.bak $ICONV < ${fn}.bak > ${fn} rm ${fn}.bak done
Two things should be changed for your local situation:
- FROM is the originating encoding (the one your original files are in)
- ToUTF is the foldername where the files that need to be converted are in. This folder may contain subfolders. Make sure you have a backup!
- Start Cygwin.
- With the cd foldername, cd.., ls commands, go to the folder on your windows machine where the ToUtf8.txt script and the ToUTF8 folder are in.
- Execute the script by typing sh ToUtf8.txt and your files will be converted.