「ファイルをUTF-8に変換する」の版間の差分

提供:MoodleDocs
移動先:案内検索
(Translation done.)
 
(同じ利用者による、間の6版が非表示)
1行目: 1行目:
{{Moodle 1.6}}
{{Moodle 1.6}}
翻訳中です - [[利用者:Mitsuhiro Yoshida|Mitsuhiro Yoshida]] 2006年8月24日 (木) 18:29 (CDT)


カスタム言語パックまたはサードパーティモジュールの言語ファイルのようなファイルは、Moodle 1.6のUTF-8データベースで使用する前に、UTF-8に変換する必要があります。
カスタム言語パックまたはサードパーティモジュールの言語ファイルのようなファイルは、Moodle 1.6のUTF-8データベースで使用する前に、UTF-8に変換する必要があります。


==*nix 等のコンピュータ==
==*nix 等のコンピュータ==
Generally, this may be done with the ''iconv'' command on Unix, Linux or a Mac.
一般的に、Unix、LinuxまたはMacでは、'''iconv'''コマンドで変換します。
一般的に、Unix、LinuxまたはMacでは、'''iconv'''コマンドで変換します。


12行目: 9行目:


==Windowsコンピュータ==
==Windowsコンピュータ==
For Windows, a free tool doesn't exist. However, the conversion may be done by using [[http://www.cygwin.com Cygwin]], a Linux-like environment for Windows, and excecuting the iconv command in that environment.
Windows用のフリーのツールは存在しません。しかし、[http://www.cygwin.com Cygwin]を使用することで変換作業を行うことができます。 [http://www.cygwin.com Cygwin]は、Windows用のLinux-like環境で、iconvコマンドを実行することができます。


Example of a working sollution on Windows with [[http://www.cygwin.com Cygwin]]:
Windowsで[http://www.cygwin.com Cygwin]を使用した変換方法例:


* Create a text file, named ToUtf8.txt
* ToUtf8.txtという名称のテキストファイルを作成します。
* Fill it with the following code
* 作成したテキストファイルに、下記のコードを書き込みます。


<pre>#!/bin/bash
<pre>#!/bin/bash
30行目: 27行目:
done</pre>
done</pre>


Two things should be changed for your local situation:
あなたの環境に合わせて2つ変更する必要があります:


# FROM is the originating encoding (the one your original files are in)
# 「FROM」は、あなたのオリジナルファイルのエンコーディングです。
# 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!
# 「ToUTF」は、変換されたファイルを入れるフォルダ名です。このフォルダは、サブフォルダを含むことができます。変換作業前に忘れずにバックアップしてください!


* Start Cygwin.
* 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.
* ''cd foldername, cd.., ls'' コマンドで、あなたのWindowsマシンのToUtf8.txtスクリプトおよびToUTF8フォルダがある場所に移動できます。
* Execute the script by typing ''sh ToUtf8.txt'' and your files will be converted.
* ''sh ToUtf8.txt'' とタイプしてスクリプトを実行することで、あなたのファイルをUTF-8に変換することができます。


[[Category:管理者]]
[[Category:管理者]]

2006年8月25日 (金) 00:47時点における最新版

Moodle 1.6


カスタム言語パックまたはサードパーティモジュールの言語ファイルのようなファイルは、Moodle 1.6のUTF-8データベースで使用する前に、UTF-8に変換する必要があります。

*nix 等のコンピュータ

一般的に、Unix、LinuxまたはMacでは、iconvコマンドで変換します。

iconv -f original_charset -t utf-8 originalfile > newfile

Windowsコンピュータ

Windows用のフリーのツールは存在しません。しかし、Cygwinを使用することで変換作業を行うことができます。 Cygwinは、Windows用のLinux-like環境で、iconvコマンドを実行することができます。

WindowsでCygwinを使用した変換方法例:

  • ToUtf8.txtという名称のテキストファイルを作成します。
  • 作成したテキストファイルに、下記のコードを書き込みます。
#!/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

あなたの環境に合わせて2つ変更する必要があります:

  1. 「FROM」は、あなたのオリジナルファイルのエンコーディングです。
  2. 「ToUTF」は、変換されたファイルを入れるフォルダ名です。このフォルダは、サブフォルダを含むことができます。変換作業前に忘れずにバックアップしてください!
  • Cygwinをスタートします。
  • cd foldername, cd.., ls コマンドで、あなたのWindowsマシンのToUtf8.txtスクリプトおよびToUTF8フォルダがある場所に移動できます。
  • sh ToUtf8.txt とタイプしてスクリプトを実行することで、あなたのファイルをUTF-8に変換することができます。