Skip to content

Commit

Permalink
Windows環境でUTF-8を強制的に使用する設定を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
kosugikun committed Jul 10, 2023
1 parent 3f6c9f1 commit a857f0a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
1 change: 0 additions & 1 deletion .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<groupId>dev.cosgy</groupId>
<artifactId>TextToSpeak</artifactId>
<version>0.4.0-beta.5</version>
<version>0.4.0-beta.6</version>
<packaging>jar</packaging>

<repositories>
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/dev/cosgy/textToSpeak/BotConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class BotConfig(private val prompt: Prompt) {
var isValid = false
private set

var isForceUTF8 = false
private set

fun load() {
isValid = false
try {
Expand Down Expand Up @@ -85,6 +88,7 @@ class BotConfig(private val prompt: Prompt) {
maxMessageCount = config.getInt("maxmessagecount")
winJTalkDir = config.getString("winjtalkdir")
helpToDm = config.getBoolean("helptodm")
isForceUTF8 = config.getBoolean("forceutf-8")
dBots = ownerId == 334091398263341056
var write = false

Expand Down
6 changes: 5 additions & 1 deletion src/main/java/dev/cosgy/textToSpeak/audio/VoiceCreation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ class VoiceCreation( // 各種設定の値を保持するためのフィール

private val characterCode: String
// 文字コードを取得するメソッド
get() = if (IS_WINDOWS) "Shift-JIS" else "UTF-8"
get(){
if(!IS_WINDOWS) return "UTF-8"

return if(bot.config.isForceUTF8) "UTF-8" else "Shift-JIS"
}

// コマンドを生成するメソッド
private fun getCommand(settings: UserSettings?, tmpFilePath: String, fileName: String): Array<String?> {
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,8 @@ maxmessagecount = 0
// Windows環境でのホストは、推奨していません。
winjtalkdir = ""

// ファイルを保存する際に文字コードを強制的にUTF-8にします。
// この設定はWindowsのみで有効です。
forceutf-8 = false

/// END OF YOMIAGEBOT CONFIG ///

0 comments on commit a857f0a

Please sign in to comment.