0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Luaプログラミング言語を使うエディタ SciTEの紹介 日本語文字化け対応

Last updated at Posted at 2025-12-09

Luaで使えるエディタ、SciTEが11月のバージョン5.5.8になっていた。

1.日本の紹介サイト

ありがとうございます。

2. SciTEのWebページ

以下ダウンロードして、解凍し、SciTE.exeをダブルクリックする。
Windows
Windows Executables
Full 64-bit download (2.9M)

あらかじめ、システム環境PATHにLua5.4.6を入れて設定していれば、以下で実行できます。

lua .\hoge.lua

3.Options → Open lua.propertiesの変更

エディタSciTEから、Luaを実行するには、メニューのTools→Goになります。

Lua5.1となって、エラーになると思います。Options → Open lua.propertiesを開きます。
スクリプトの一番下に行きます。変更前、

# compatible with LuaBinaries for Lua 5.1; will work on both platforms.
command.compile.*.lua=luac5.1 -o "$(FileName).luc" "$(FileNameExt)"
# Lua 5.1
command.go.*.lua=lua5.1 "$(FileNameExt)"
# Lua 4.0
#command.go.*.lua=Lua-4.0.exe -c -f "$(FileNameExt)"

変更後、

# compatible with LuaBinaries for Lua 5.1; will work on both platforms.
command.compile.*.lua=luac -o "$(FileName).luc" "$(FileNameExt)"
# Lua 5.4.6
command.go.*.lua=lua "$(FileNameExt)"
# Lua 4.0
#command.go.*.lua=Lua-4.0.exe -c -f "$(FileNameExt)"

インストールしているluaが、lua.exeでなくてlua54.exeだったら上記は、

# Lua 5.4.6
command.go.*.lua=lua54 "$(FileNameExt)"

に変更してみてください。

4.日本語対応化 utf-8

Luaのコードがutf-8で保存され日本語が文字化けしないためには、
SciTEを起動し、Options -> Open Global Options Fileを選択します。
333行目を以下に変更します。

# Internationalisation
# Japanese input code page 932 and ShiftJIS character set 128
#code.page=932
#character.set=128
# Unicode
code.page=65001
#code.page=0
character.set=204

スクリーンショット 2025-12-09 162903.png

もし、Lua実行で日本語文字化けのときは、ファイルがutf-8なら、ターミナルから起動する際は、utf-8に変更、以下を実行

[Console]::OutputEncoding = [System.Text.Encoding]::GetEncoding('utf-8')

Lua実行で日本語文字化けのときは、ファイルがshift-jisなら、以下、ターミナルでshift-jisに変更します。

[Console]::OutputEncoding = [System.Text.Encoding]::GetEncoding('shift-jis')

日々、学びですね。ありがとうございます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?