Skip to content

Commit

Permalink
fix: 解决配置文件编码问题,使用UTF-16编码编写ini
Browse files Browse the repository at this point in the history
  • Loading branch information
snomiao committed Apr 3, 2021
1 parent 90af027 commit fe3bf32
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Core/CapslockX-Config.ahk
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
; 保存为 save with UTF8 with DOM
;
清洗为_UTF16_WITH_BOM_型编码(path){
FileRead ModuleCode, %path%
FileDelete %path%
FileAppend %ModuleCode%, %path%, UTF-16
}
CapsLockX_ConfigSet(field, varName, setValue, comment := ""){
if(!CapsLockXConfigPath){
MsgBox, 配置文件目录设定异常
return
}
清洗为_UTF16_WITH_BOM_型编码(CapsLockXConfigPath)
content := setValue
; 对配置自动重新排序
IniDelete, %CapsLockXConfigPath%, %field%, %varName%
Expand All @@ -13,6 +23,11 @@ CapsLockX_ConfigSet(field, varName, setValue, comment := ""){
}

CapsLockX_Config(field, varName, defaultValue, comment := ""){
if(!CapsLockXConfigPath){
MsgBox, 配置文件目录设定异常
return
}
清洗为_UTF16_WITH_BOM_型编码(CapsLockXConfigPath)
IniRead, %varName%, %CapsLockXConfigPath%, %field%, %varName%, %defaultValue%
content := %varName% ; 千层套路XD
; 对配置自动重新排序
Expand Down

0 comments on commit fe3bf32

Please sign in to comment.